fix(fs/Local#readFile): fix flags handling

This commit is contained in:
Julien Fontanet 2024-01-31 16:50:29 +01:00
parent 4c79a78a05
commit 215579ff4d

View File

@ -171,7 +171,12 @@ export default class LocalHandler extends RemoteHandlerAbstract {
}
}
async _readFile(file, options) {
async _readFile(file, { flags, ...options } = {}) {
// contrary to createReadStream, readFile expect singular `flag`
if (flags !== undefined) {
options.flag = flags
}
const filePath = this.getFilePath(file)
return await this.#addSyncStackTrace(retry, () => fs.readFile(filePath, options), this.#retriesOnEagain)
}