Upload Files to Your Site by URL in Node

You can easily upload files by their URL on your back end in Node; here’s how.

Start by ensuring that you have the NPM package from Filestack:

npm install filestack-js

You can install that globally with -g, or just within your project as shown above.

Next, init that in your code. I’ll create a file called upload_by_url.js, and enter the following code:

const apikey = 'MyActualAPIKEYisDifferent';
const client = require('filestack-js').init(apikey);

const imgurl = 'https://c1.staticflickr.com/4/3258/2673143903_db2690e28f_b.jpg';
client.storeURL( imgurl ).then( res => console.log(res) );

That’s it! Execute on the CLI to test:

> node upload_by_url.js

The URL you chose to pass in to the client.storeURL() function will be added to the Filestack app associated with the APIKEY you gave.

Terminal view of running node to upload by URL
Read more about the JS SDK here: https://github.com/filestack/filestack-js

Read More →

Ready to get started?

Create an account now!