Hello everyone,
This is my first time posting so please let me know if there is additional
context or conventions I should be providing. I also posted this in the
TiddlyWiki group as I didn't know where the line is drawn between the types
of questions.
I am trying to retrieve a json object in the format they are imported and
exported by TiddlyWiki from AWS S3 and then create a tiddler with the
response. I am new to Javascript and am very open to suggestions for other
improvements.
My code which successfully retrieves the object and writes the json to the
console is as follows:
```
(function(){
"use strict";
exports.name = "getobject";
exports.params = [
{key: ""}
];
exports.run = function(key) {
function handleresult(err, data) {
if(err)throw err;
console.log(data.Body.toString('utf-8'));
// Make a tiddler out of data.Body.toString('utf-8') here
return data
}
AWS.config.update({
accessKeyId: 'MyAccessKey',
secretAccessKey: 'MySecretKey',
region: 'us-east-2'
});
var s3 = new AWS.S3();
var params = {
Bucket: 'testtiddlybucket',
Key: key
}
var result = s3.getObject(params, handleresult);
return "Results from list objects call with prefix " + result
};
})();
```
Is there a Javascript macro I can call to implement the Tiddler creation?
Thanks in advance!
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywikidev/756be27c-77cb-482b-95b4-9a32d0be3f28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.