Closed vfa-tamhh closed 4 years ago
On Monaca Ev:
new NCMB(appKey, clientKey).File.download("sample.txt") .then(function(data) { console.log("File.download success data: " + data); }) .catch(function(err) { console.log("error : " + err.message); console.log("error stack: " + err.stack); })
On NodeJS Ev:
var NCMB = NCMB || require("./lib/ncmb"); var ncmb = new NCMB(appKey, clientKey); const fs = require('fs'); var fileName = "sample"; // png, jpg, pdf, zip, xlsx, mp4, mp3, json, txt var extension = ".txt"; fileName = fileName + extension; ncmb.File.download(fileName) .then(function(fileData){ // ファイル取得後処理 fs.writeFile(fileName, fileData, function(error){ if (error) { console.log(error); } else { console.log('success'); } }); }) .catch(function(err){ // エラー処理 console.log(err); });
概要(Summary)
動作確認手順(Step for Confirmation)
On Monaca Ev:
On NodeJS Ev: