@node-wot/binding-file
Advanced tools
Comparing version 0.8.11 to 0.8.12
@@ -13,3 +13,3 @@ "use strict"; | ||
const core_1 = require("@node-wot/core"); | ||
const fs = require("fs"); | ||
const fs_1 = require("fs"); | ||
const node_url_1 = require("node:url"); | ||
@@ -28,4 +28,5 @@ const { debug } = (0, core_1.createLoggers)("binding-file", "file-client"); | ||
debug(`Reading file of Content-Type ${contentType} from path ${filePath}.`); | ||
const resource = fs.createReadStream(filePath); | ||
return new core_1.Content(contentType, resource); | ||
const fileHandle = yield fs_1.promises.open(filePath); | ||
const body = fileHandle.createReadStream(); | ||
return new core_1.Content(contentType, body); | ||
}); | ||
@@ -46,5 +47,3 @@ } | ||
const filePath = (0, node_url_1.fileURLToPath)(form.href); | ||
const writeStream = fs.createWriteStream(filePath); | ||
const buffer = yield content.toBuffer(); | ||
writeStream.end(buffer); | ||
yield fs_1.promises.writeFile(filePath, content.body); | ||
}); | ||
@@ -51,0 +50,0 @@ } |
{ | ||
"name": "@node-wot/binding-file", | ||
"version": "0.8.11", | ||
"version": "0.8.12", | ||
"description": "File client protocol binding for node-wot", | ||
@@ -17,6 +17,6 @@ "author": "Eclipse Thingweb <thingweb-dev@eclipse.org> (https://thingweb.io/)", | ||
"devDependencies": { | ||
"@node-wot/td-tools": "0.8.11" | ||
"@node-wot/td-tools": "0.8.12" | ||
}, | ||
"dependencies": { | ||
"@node-wot/core": "0.8.11" | ||
"@node-wot/core": "0.8.12" | ||
}, | ||
@@ -23,0 +23,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
13524
150
+ Added@node-wot/core@0.8.12(transitive)
+ Added@node-wot/td-tools@0.8.12(transitive)
- Removed@node-wot/core@0.8.11(transitive)
- Removed@node-wot/td-tools@0.8.11(transitive)
Updated@node-wot/core@0.8.12