-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Is your feature request related to a problem?
In our current project, we have found that especially with the LocalAssetStorageStrategy implementation, we are unable to specify an encoding option for the AssetStorageStrategy.readFileToStream method and it always uses "binary" when calling fs.createReadStream()
Of course it's the same with AssetStorageStrategy.writeFileFromStream.
Describe the solution you'd like
I would like to update the AssetStorageStrategy interface to allow implementations to specify an option for users to choose an encoding without enforcing a specific encoding. While doing it I would also update the LocalAssetStorageStrategy implementation of the interface to allow for specifying the encoding.
To allow for backwards compatibility, not specifying this option could still result in the use of "binary", since fs.createReadStream() defaults to utf8 encoding, specifying uft8 would be the same as passing nothing to fs.createReadStream().
Describe alternatives you've considered
Until that is in place, we will create our own implementation of the AssetStorageStrategy interface which doesn't have that limitation
Additional context
| const writeStream = fs.createWriteStream(filePath, 'binary'); |
| const readStream = fs.createReadStream(this.identifierToFilePath(identifier), 'binary'); |