node-gdrive
Upload file to google drive
Installation
With npm do:
npm install node-gdrive
Use command line global:
npm install node-gdrive -g
Config
gdrive token:get
Usage
Node project
const { Upload, Download } = require("node-gdrive");
let filePath = 'foo.txt';
var upload = new Upload(filePath, {share: true});
upload.on('*', (event, data) => {
console.log(event, data);
});
let fileId = "1eoAgH8xgBkkUDXkTdyPSHSbaJViv33oX";
var download = new Download();
download
.download(fileId, {
resumable: true,
force: false,
output: './tmp/',
})
.then(file => {
console.log("file", file);
})
.catch(err => {
console.error("err", err);
});
Commands line
gdrive upload file.txt --share user@gmail.com
gdrive donwload 1eoAgH8xgBkkUDXkTdyPSHSbaJViv33oX
gdrive --help
License
MIT