balena-image-fs
Advanced tools
Comparing version 7.2.3-build-renovate-major-typescript-with-types-8c70b8a8ee26ac9ac45178b9a8775b04f8675f82-1 to 7.3.0-build-promises-216f9fd9aff5d3192cbb03f1d8597c8b27fa290e-1
@@ -24,2 +24,4 @@ "use strict"; | ||
const fatfs = require("fatfs"); | ||
const Fs = require("fs"); | ||
const util_1 = require("util"); | ||
const file_disk_1 = require("file-disk"); | ||
@@ -63,2 +65,25 @@ const partitioninfo = require("partitioninfo"); | ||
}); | ||
// Check whether fatfs added the promises namespace on their side | ||
if (fat.promises == null) { | ||
// Lazily populate the promise based variants | ||
const originalFatKeys = Object.keys(fat); | ||
Object.defineProperty(fat, 'promises', { | ||
enumerable: true, | ||
configurable: true, | ||
get() { | ||
const promises = {}; | ||
for (const key of originalFatKeys) { | ||
const value = fat[key]; | ||
if (typeof value === 'function' && (key in Fs.promises)) { | ||
promises[key] = (0, util_1.promisify)(value); | ||
} | ||
} | ||
originalFatKeys.length = 0; | ||
// We need the delete first as the current property is read-only | ||
// and the delete removes that restriction | ||
delete this.promises; | ||
return (this.promises = promises); | ||
}, | ||
}); | ||
} | ||
return await fn(fat); | ||
@@ -65,0 +90,0 @@ } |
@@ -7,5 +7,5 @@ # Change Log | ||
## 7.2.3 - 2024-01-02 | ||
## 7.3.0 - 2024-12-31 | ||
* Update dependency typescript to v5 [Self-hosted Renovate Bot] | ||
* Add the promises namespace as part of the exposed fs [Thodoris Greasidis] | ||
@@ -12,0 +12,0 @@ ## 7.2.2 - 2024-01-02 |
{ | ||
"name": "balena-image-fs", | ||
"version": "7.2.3-build-renovate-major-typescript-with-types-8c70b8a8ee26ac9ac45178b9a8775b04f8675f82-1", | ||
"version": "7.3.0-build-promises-216f9fd9aff5d3192cbb03f1d8597c8b27fa290e-1", | ||
"description": "Image filesystem manipulation utilities", | ||
@@ -51,3 +51,3 @@ "main": "build/index.js", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.0" | ||
"typescript": "^4.9.4" | ||
}, | ||
@@ -65,4 +65,4 @@ "dependencies": { | ||
"versionist": { | ||
"publishedAt": "2024-01-02T19:45:17.565Z" | ||
"publishedAt": "2024-12-31T12:04:20.702Z" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
28788
173
1