I use Node.js to host a web server. The server will communicate with different third party storage providers, such as Box, dropbox, googledrive, amazon s3, skydrive, ftp server, etc. The server will download files from or upload files to the storage providers.
I'm using the OAuth module to implement the authorization process and get the auth_token and auth_secret. OAuth module unifies the authorization interfaces for different servers. OAuth module encapsulates the APIs of the oauth servers and provides a uniform and friendly interfaces. With OAuth module, I don't need to call the API of the oauth servers in my code. It is pretty good and saves lot of my work.
I encounter some difficulties when download/upload files from/to the different storage providers. I must write the different implementations for each storage server. Such as calling box APi to upload file to box, calling s3 API to upload file to s3, etc. I wonder if there is some node module which encapsulates all the APIs for the storage providers, which works like the OAuth module for the authorization APIs.
The pseudo code below expresses how I expect this kind of module works. I suppose it's name is 'storage'.
var storage = require("storage"); // This is the storage library I'm looking for.
var s3 = storage.s3(s3_aouth_token_and_secret); // The declaration for the s3_aouth_token_and_secret is omitted for simplification.
var box = storage.box(box_aouth_token_and_secret);
var dropbox = storage.dropbox(dropbox_aouth_token_and_secret);
var local_file_name = "./report.docx";
s3.upload(s3_parent_folder_id, local_file_name); // Upload local file to s3
box.upload(box_parent_folder_id, local_file_name); // Upload local file to box
dropbox.upload(dropbox_parent_folder_id, local_file_name); // Upload local file to dropbox
var local_pah = "./downloads/';
s3.download(s3_file_id, local_pah);
box.download(box_file_id, local_pah);
dropbox.download(dropbox_file_id, local_pah);
Please let me know which node module can meet my requirement.
Thanks,
Jeffrey
You should check out Temboo - it does exactly what you're looking. Temboo normalizes APIs so that they all look and and feel the same. Once you know how to talk to a single storage API via Temboo you know to talk them to all.
Temboo has a Node.js SDK, and you can find out more about the storage APIs that Temboo supports here.
(Full disclosure: I work at Temboo)