transfer.js

Version Build Coverage

Node.js CLI tool for easy file sharing with transfer.sh

Install

The easiest way to get transfer.js is with npm or yarn:

$ npm install -g transfer.js
$ yarn global add transfer.js

CLI Usage

Example

$ transfer-js hello.txt --copy

Will return a link to the resource and copy it to your clipboard.

Options

Option Description
-m, --max-days Maximum number of days the file will stay on transfer.sh.
-M, --max-downloads Maximum number of downloads allowed.
-D, --download Download the file from the given URL.
-n, --file-name Name to use for the upload.
-c, --copy Copy the file URL or path to the clipboard.
-N, --no-progress Don't show the progress bar.
-o, --output Output path of the downloaded file.

Module usage

Example

const Transfer = require('transfer.js');

// Upload
new Transfer('./Hello.txt')
  .upload().progress((prog) => {
    console.log((prog.current / prog.total * 100).toFixed(1) + '%');
  }).then(console.log).catch(console.error);

// Download
new Transfer('https://transfer.sh/4bcD3/Hello.txt')
  .download().progress((prog) => {
    console.log((prog.current / prog.total * 100).toFixed(1) + '%');
  }).then(console.log).catch(console.error);

Documentation

The documentation is available here.

Dependencies Dependencies

  • cli-progress: Easy to use Progress-Bar for Command-Line/Terminal Applications
  • clipboardy: Access the system clipboard (copy/paste)
  • got: Simplified HTTP requests
  • mime-types: The ultimate javascript content-type utility.
  • minimist: parse argument options
  • progress-promise: Promise subclass with mechanism to report progress before resolving

Dev Dependencies Dev Dependencies

  • @reconbot/jsdoc-theme: A JSDoc Theme / Template
  • chai: BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
  • chai-as-promised: Extends Chai with assertions about promises.
  • codecov: Uploading report to Codecov: https://codecov.io
  • eslint: An AST-based pattern checker for JavaScript.
  • jsdoc: An API documentation generator for JavaScript.
  • mocha: simple, flexible, fun test framework
  • nyc: the Istanbul command line interface

TODO

  • [ ] Add more options to the executable
  • [ ] Use a better argument parser
  • [ ] Allow custom transfer domains
  • [ ] Add executable tests

Credits

Based on transfer-sh by roccomuso.

License

Licensed under the ISC license.