Hi Justin It may not be exactly what you need, but there is an AWS plugin in the core plugin library that includes commands for use under Node.js to load, save and render tiddlers from files stored on S3. I've pasted the docs below.
(Stuff like this can't be done as a JS macro: they are limited to returning a single string, and are not allowed to modify the tiddler store). Best wishes Jeremy Commands Perform operation on Amazon Web Services --aws <sub-command> [<parameter> ...] "s3-load" subcommand Load tiddlers from files in an S3 bucket. --aws s3-load <region> <bucket> <filename>... region: AWS region bucket: name of the bucket containing the files filename: one or more filenames of the files to load The content in the files is deserialized according to the content type reported by S3. "s3-savetiddler" subcommand Save a raw tiddler to a file in an S3 bucket. --aws s3-savetiddler <title> <region> <bucket> <filename> <zipfilename> <savetype> title: title of the tiddler to save region: AWS region bucket: name of the bucket to save the saved file filename: filename of the saved file zipfilename: optional; the file will be packed into a ZIP file with the specified name savetype: optional; the MIME type for the saved file (defaults to type or "text/html") "s3-savetiddlers" subcommand Save raw tiddlers matching a filter to an S3 bucket. --aws s3-savetiddlers <filter> <region> <bucket> <filenamefilter> <savetypefilter> filter: filter identifying tiddlers to render region: AWS region bucket: name of the bucket to save the files filenamefilter: filter for converting tiddler titles to filepaths (eg [encodeuricomponent[]addprefix[files/]addsuffix[.html]]) savetypefilter: optional; a filter that is passed the title of the tiddler being saved and should yield the MIME type for the saved file (defaults to a filter that yields the value of the type field) "s3-rendertiddler" subcommand Save the results of rendering a tiddler to a file in an S3 bucket. --aws s3-rendertiddler <title> <region> <bucket> <filename> <type> <template> <zipfilename> <savetype> title: title of the tiddler to render region: AWS region bucket: name of the bucket to save the rendered file filename: filename of the rendered file type: optional render type (defaults to "text/html") template: optional template (defaults to directly rendering the tiddler without using a template) zipfilename: optional; the file will be packed into a ZIP file with the specified name savetype: optional; the MIME type for the saved file (defaults to type or "text/html") "s3-rendertiddlers" subcommand Save the results of rendering tiddlers identified by a filter to files in an S3 bucket. --aws s3-rendertiddlers <filter> <template> <region> <bucket> <filenamefilter> <type> <savetypefilter> filter: filter identifying tiddlers to render template: template for rendering each tiddler region: AWS region bucket: name of the bucket to save the rendered file filenamefilter: filter for converting tiddler titles to filepaths (eg [encodeuricomponent[]addprefix[files/]addsuffix[.html]]) type: optional render type (defaults to "text/html") savetypefilter: optional; a filter that is passed the title of the tiddler being rendered and should yield the MIME type for the saved file (defaults to the value of the type field via [is[tiddler]get[type]]) -- Jeremy Ruston [email protected] https://jermolene.com > On 23 Aug 2018, at 01:57, Justin Baacke <[email protected]> wrote: > > 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. -- 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/CFD7FB75-C18B-4A67-BF3B-B6FBDD81AB0F%40gmail.com. For more options, visit https://groups.google.com/d/optout.
