send-anywhere

1.1.0 • Public • Published

A sweet layer on top of Send-Anywhere API to use it with node.js

Installation

npm install send-anywhere

API

Initialize SDK

You can get the API key by requesting it from Send-Anywhere team.

var config = {
    API_KEY  : "XXXXXXXXXXXXXXXXXXXXXXXX" ,
    PROFILE_NAME :  'YYYYYY'  
};
 
var sa = require('./index.js')(config);

sendFile(SRC_FILE , detailsCallback , completedCallback)

sa.sendFile('package.json' , function(err , details){
    console.log(details);
} , function(err , completedObj){
    console.log(completedObj);
});
  • detailsCallback - Use this to fetch the details that are required for receiving the file. check out details object for further information.
  • completedCallback - Use this to execute something after the transfer of file is complete.

receiveAsData(KEY , receivedCallback)

sa.receiveAsData(KEY ,function(err , data , reponse){
  console.log(data);
  console.log(response); //contains headers and other meta data
});

Error Handling

Use the err objects in the callback to handle errors. err has two objects err.error and err.response. In case you would want to dig deep on your errors , a knowledge about this may come handy.

Resources

Contributing

Anything ! More than welcomed.

License

Package Sidebar

Install

npm i send-anywhere

Weekly Downloads

3

Version

1.1.0

License

GPL-3.0

Last publish

Collaborators

  • scriptnull