auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const fs = require('fs')
const JSDOM = require('jsdom').JSDOM
const Turndown = require('turndown')
const { Readability } = require('@mozilla/readability')
const doc = new JSDOM(event.body.data, { url: event.body.url })
const reader = new Readability(doc.window.document)
const readerDoc = reader.parse()
const turndownService = new Turndown({ emDelimiter: '*' })
const title = event.body.title
let body = `*[View Original](${event.body.url})*\n\n` + turndownService.turndown(readerDoc.content)
if (event.body.tags) {
const tagsList = event.body.tags.split(',')
const hashtags = tagsList.map((a) => `#${a}`)
body = hashtags.join(' ') + '\n\n' + body
}
fs.writeFileSync(`/tmp/${title}.md`, body)
A list of parent folder IDs, entered manually or retrieved from a previous file list operation
The path to the file, e.g. /tmp/myFile.csv .
async
(params, auths) => {
}
const fs = require("fs")
const {google} = require('googleapis')
const driveAuth = new google.auth.OAuth2()
driveAuth.setCredentials({ access_token: auths.google_drive.oauth_access_token })
const drive = await google.drive({ version: 'v3', auth: driveAuth });
this.uploadResponse = (await drive.files.create({
resource: {
name: params.filename,
originalFilename: params.filename,
parents: params.parents,
},
media: {
mimeType: params.filetype,
uploadType: "media",
body: fs.createReadStream(params.pathToFile)
},
fields: '*'
})).data
async
params => {
}
const options = {
subject: params.subject,
text: params.text,
}
if (params.html) {
options.html = params.html
}
if (params.include_collaborators) {
options.include_collaborators = params.include_collaborators
}
$send.email(options)