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");
fs.writeFileSync(`/tmp/myfile`, Buffer.from("hello, world"));
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const sparkline = require('node-sparkline');
const fs = require('fs');
const path = require('path');
//const { promisify } = require('util');
//const writeFile = promisify(fs.writeFile);
const values = [
7.45162149487362,
7.465136012334006,
7.461519350494333,
7.465413133687816,
7.511812989297731,
7.8776700262848705,
8.032346630203442,
8.16774825735731,
8.229668975583916,
8.238856463169155,
8.257030953739477,
8.236774822602545,
8.190300721027079,
8.13603900682545,
7.93046805606676,
7.873374158326343,
7.744961642971777,
7.81594453373647,
7.8637008039663385,
7.8509859843825485,
7.774829877417928,
7.7928900555733325,
7.802988598458197,
7.811829326761041,
7.809513333293174,
7.755694552580595,
7.740737298560772,
7.74028834115583,
7.736695879281692,
7.8722879337259215,
7.983071455545634,
8.058338236458502,
8.083090572680065,
8.245677151169778,
8.422209847286164,
8.360618922692863,
8.377466223406124,
8.410567947020702,
8.203756986058428,
8.138869751165217,
8.150320536729287,
8.255427190765817,
8.234015221444672,
8.32323859535365,
8.399964490840985,
8.369376812486951,
8.396646528694426,
8.476018970266116,
8.601040094779913,
8.653684187748134,
8.669531929002035,
8.75787394946614,
8.610224379717435,
8.826478684824501,
9.254604630288334,
9.4425084451639,
9.655424003726568,
9.514980168649606,
9.50452321495158,
9.34102252811664,
9.504210992279024,
9.584058247196362,
9.62409466404434,
9.58620251496069,
9.556253532418923,
9.551316876883936,
9.629350226102432,
9.630441160758757,
9.423599458967375,
9.631422356177499,
9.564332486800726,
9.692641605412843,
9.620514058161152,
9.711097505491407,
9.790968990509276,
9.795394005541661,
9.805505507268508,
9.755163114125788,
9.786393756280214,
9.65383194888734,
9.371223163817163,
9.333064636470029,
9.392793265218367,
9.42918366346151,
9.378188776334413,
9.161911971095552,
8.908976735168041,
8.998591205295943,
8.86119804919629,
8.705310429352274,
8.672491467964697,
8.66018442224833,
8.697003863890908,
8.658116987717094,
8.81197229728009,
9.080238887017112,
8.996947622581692,
8.828905538101615,
8.854916765407182,
8.617945648751684,
8.63866319409813,
8.643344601216542,
8.521692192951871,
8.539957442721386,
8.515027737186955,
8.587694622710071,
8.65752808321314,
8.609443552098547,
8.57258413338731,
8.5544728042285,
8.590224962764903,
8.614407107056692,
8.593195877435297,
8.525904837005037,
8.43499770655282,
8.484828598550685,
8.657854167302537,
8.764298684103162,
9.257060172600116,
9.23601646121829,
9.344144079057996,
9.164669885696714,
9.10033926934154,
9.110017066872873,
9.070139694356872,
9.156952150982484,
9.984874475898685,
9.570086144819529,
9.693334058951839,
9.38151954184341,
9.514025707420691,
9.507324295116355,
9.608760727642208,
9.517461749024964,
9.514193077146198,
9.863268401452943,
9.912986379354715,
9.998331791015696,
10.094629517602177,
10.245244210395791,
10.240302967862881,
10.223367528548648,
10.261645687066025,
11.800825676399295,
12.052693548659365,
11.904241306948931,
11.822314657602474,
12.230277585232571,
13.512054848486294,
12.675104774147874,
12.705815289569507,
12.564530849193703,
12.61735682536595,
12.518586670949885,
12.689352790506367,
13.11039983067567,
13.407938392152904,
13.949617785120928,
13.467738708696,
13.899645824427985,
15.637331996606186,
15.337937695286223,
14.816581598662703,
14.48289778320874,
14.5241804340251,
13.97155114023251,
13.671995384944877,
13.82464643312032,
];
try {
const svg = sparkline({
values,
width: 250,
height: 150,
stroke: '#57bd0f',
strokeWidth: 2,
strokeOpacity: 1,
});
fs.writeFileSync(`/tmp/line.svg`, (svg));
//fs.writeFile('/tmp/sparkline.svg', svg);
// svg is a string with SVG + polyline tags
// ...
/*
'use strict';
let data = svg;
let buff = new Buffer.from(data);
let base64data = buff.toString('base64');
return base64data
console.log('"' + data + '" converted to Base64 is "' + base64data + '"');
*/
} catch (e) {
console.error(e.toString());
}
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
var axios = require('axios');
var FormData = require('form-data');
var fs = require('fs');
var data = new FormData();
data.append('File', fs.createReadStream('/tmp/line.svg'));
var config = {
method: 'post',
url: 'https://v2.convertapi.com/convert/svg/to/png?Secret=UvuFEy9Yj4MRKRza&StoreFile=true',
headers: {
...data.getHeaders()
},
data : data
};
await axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
async
(params, auths) => {
}
const config = {
method: params.method,
url: params.url,
params: params.query,
headers: params.headers,
responseType: params.responseType,
data: params.data,
}
if (params.auth) config.auth = params.auth
return await require("@pipedreamhq/platform").axios(this, config)
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const convertapi = await require('convertapi')('UvuFEy9Yj4MRKRza');
convertapi.convert('png', {
File: '/tmp/line.svg'
}, 'svg').then(function(result) {
result.saveFiles('/tmp/');
});
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const sharp = require("sharp")
sharp("/tmp/line.svg")
.jpeg({
quality: 100,
chromaSubsampling: '4:4:4'
})
.toFile("/tmp/line.jpeg")
.then(function(info) {
console.log(info)
})
.catch(function(err) {
console.log(err)
})
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const imgbbUploader = require("imgbb-uploader");
// Some promise of base64 data
const base64str = () =>
new Promise((resolve) => {
return setTimeout(() => {
resolve(
"iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAEklEQVR42mNcLVNbzwAEjDAGACcSA4kB6ARiAAAAAElFTkSuQmCC",
);
}, 1000);
});
// Your barebone async function
const myUrl = async (name) => {
return await imgbbUploader({
apiKey: "feab72e4191fe07369393c701af07f7e",
base64string: await base64str(),
name: name,
})
.then((res) => {
console.log(`Handle success: ${res.url}`);
return res.url;
})
.catch((e) => {
console.error(`Handle error: ${e}`);
return "http://placekitten.com/300/300";
});
};
myUrl("Dolunay_Obruk-Sama_<3");
console.log(myUrl)
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
var axios = require('axios');
var FormData = require('form-data');
var fs = require('fs');
var data = new FormData();
data.append('image', fs.createReadStream('/tmp/line.jpeg'));
data.append('expiration', '600');
var config = {
method: 'post',
url: 'https://api.imgbb.com/1/upload?key=feab72e4191fe07369393c701af07f7e',
headers: {
...data.getHeaders()
},
data : data
};
await axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
A binary file, base64 data, or a URL for an image. (up to 16MB)
async
(params, auths) => {
}
const data = {
image: params.image,
name: params.name,
}
const config = {
method: "post",
url: `https://api.imgbb.com/1/upload?key=${auths.imgbb.api_key}`,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
data: require("qs").stringify(data),
}
return await require("@pipedreamhq/platform").axios(this, config)
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const imgbbUploader = require("imgbb-uploader");
await imgbbUploader("feab72e4191fe07369393c701af07f7e", "/tmp/line.svg")
.then((response) => console.log(response))
.catch((error) => console.error(error));
async
(params, auths) => {
}
const config = {
method: params.method,
url: params.url,
params: params.query,
headers: params.headers,
responseType: params.responseType,
data: params.data,
}
if (params.auth) config.auth = params.auth
return await require("@pipedreamhq/platform").axios(this, config)
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");
this.fileData = fs.readFileSync(`/tmp/line.svg`).toString();