Published
Edited
Mar 9, 2020
Insert cell
Insert cell
archiver = require('https://bundle.run/archiver@3.1.1')
Insert cell
request = require('https://bundle.run/request@2.88.2')
Insert cell
ngrok_url = "https://3f7cb84e.ngrok.io"
Insert cell
archive = archiver('zip', {
zlib: { level: 9 } // Sets the compression level.
});
Insert cell
// archive.on('error', function(err) {
// console.log("ERROR", err.stack);
// });
Insert cell
// append a file from string
archive.append('string cheese!', { name: 'file2.txt' });
Insert cell
md`try 1`
Insert cell
// new Promise((resolve, reject) => {
// archive.on('error', reject);
// archive.on('finish', () => { // request is made on 'finish'
// const formData = {
// file: {
// value: archive,
// options: {
// filename: 'test.zip',
// contentType: 'application/zip',
// knownLength: archive.pointer(), // pass the pointer at the end to form-data
// },
// },
// };
// request.post({
// url: ngrok_url,
// formData,
// headers: {
// 'content-type': 'multipart/form-data',
// },
// }, (err, resp) => {
// if (err) {
// return reject(err);
// }
// return resolve(resp);
// });
// });
// archive.finalize();
// });
Insert cell
md`try 2`
Insert cell
// archive.pipe(request({
// method: "POST",
// //uri: "https://api.netlify.com/api/v1/sites/" + properties.site_id + "/deploys",
// uri: ngrok_url,
// form: {zip_blob: archive},
// headers: {'Content-Type': 'application/octet-stream'}
// }));
Insert cell
// archive.finalize()
Insert cell
md`try 3`
Insert cell
// archive.pipe(request.post(ngrok_url));
Insert cell
archive.finalize();
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more