Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roccomuso/transfer-sh
Node.js CLI tool for easy file sharing using Transfer.sh
https://github.com/roccomuso/transfer-sh
cli file file-sharing nodejs sharing tool transfer
Last synced: 29 days ago
JSON representation
Node.js CLI tool for easy file sharing using Transfer.sh
- Host: GitHub
- URL: https://github.com/roccomuso/transfer-sh
- Owner: roccomuso
- Created: 2017-02-24T22:39:54.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-06-22T13:44:02.000Z (over 2 years ago)
- Last Synced: 2024-12-26T04:03:54.475Z (about 1 month ago)
- Topics: cli, file, file-sharing, nodejs, sharing, tool, transfer
- Language: JavaScript
- Homepage:
- Size: 152 KB
- Stars: 25
- Watchers: 4
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# transfer-sh [![NPM Version](https://img.shields.io/npm/v/transfer-sh.svg)](https://www.npmjs.com/package/transfer-sh) [![Build Status](https://travis-ci.org/roccomuso/transfer-sh.svg?branch=master)](https://travis-ci.org/roccomuso/transfer-sh) [![Dependency Status](https://david-dm.org/roccomuso/transfer-sh.png)](https://david-dm.org/roccomuso/transfer-sh) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
> Node.js CLI tool for easy file sharing using Transfer.sh
### Install
The easiest way to get **transfer-sh** is with npm:
$ npm install -g transfer-sh
### CLI Usage
$ transfer hello.txt
Will return a link to the resource and automatically you'll have it copied to your clipboard.
PS.
transfer
is an alias fortransfer-sh
.Encrypt a file using a password:
$ transfer hello.txt -p s3cr3t
### Example
```javascript
var Transfer = require('transfer-sh')/* Encrypt and Upload */
new Transfer('./Hello.md', {password: 's3cr3t'})
.upload()
.then(function (link) { console.log(link) })
.catch(function (err) { console.log(err) })/* Decrypt */
new Transfer('./Hello.enc', {password: 's3cr3t'})
.decrypt('Output.md') // or writable stream
.then(function (wStream) { console.log('Decrypted!') }) // it returns a writableStream
.catch(function (err) { console.log(err) })```
**NB.**: The constructor accepts also a `Readable` stream as 1th param, in that case make sure to provide a `name` option.
### Options
`password`: optional field, if provided will encrypt the file with `aes-256-cbc` no-salt and base64 encoded before the upload.
You can then easily decrypt your file using `transfer-sh` itself:
$ transfer -d hello.enc -p s3cr3t [-o output.txt]
or the `openssl` util:
$ openssl aes-256-cbc -d -a -nosalt -in -out -k
openssl params explanation:
`-d` decrypt.
`-a` to decode base64 (with line break). NB. The file is base64 encoded to be easy human-readable and to allow easy copy-paste.
`-nosalt` The used node crypto lib by default doesn't apply any salt.
`-in` input encrypted file.
`-out` output decrypted file.
`-k` password.
## Author
Rocco Musolino ([@roccomuso](https://twitter.com/roccomuso))
## LICENSE
MIT