Skip to content

Commit

Permalink
removing utf8 format from local file.load
Browse files Browse the repository at this point in the history
  • Loading branch information
frytg committed Jul 30, 2020
1 parent 0eefa16 commit 4308971
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@swrlab/node-storage-wrapper",
"version": "0.0.6",
"version": "0.0.7",
"description": "Wrapping AWS S3, GCP GCS, file storage",
"main": "./src/index.js",
"engines": {
Expand Down
8 changes: 5 additions & 3 deletions src/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const fetch = require('node-fetch');

const loadLocalFile = (that, uri) =>
new Promise((resolve, reject) => {
that.sdk.fs.readFile(uri, 'utf8', (err, data) => {
that.sdk.fs.readFile(uri, (err, data) => {
if (err) reject(err);
else resolve(data);
});
Expand Down Expand Up @@ -68,11 +68,13 @@ module.exports = async function (uri) {
return Promise.reject('fetching url failed with status > ' + file.status);
}
} else {
// log progress
this.sdk.log(this, 'log', ['storage.load.local >', uri]);

// local file
let file = await loadLocalFile(this, uri);

this.sdk.log(this, 'log', ['storage.load.local >', uri]);

// return file
return Promise.resolve(file);
}
} catch (err) {
Expand Down

0 comments on commit 4308971

Please sign in to comment.