forked from wkh237/react-native-fetch-blob
-
Notifications
You must be signed in to change notification settings - Fork 793
Open
Description
When i write arabic content and try to read them i get this error :
readStream error Error: Failed to convert data to utf8 encoded string. This might be because this encoding cannot be used for this data.
both call are made with 'utf8' param
export async function writeStream(path, content, encoding = "utf8") {
return new Promise(function(resolve, reject) {
RNFetchBlob.fs.writeFile(path, "", encoding).then(res => {
RNFetchBlob.fs.writeStream(path, encoding).then(ofstream => {
ofstream.write(content);
ofstream.close();
return resolve(true);
});
});
});
}
export async function readStream(path, encoding = "utf8") {
let data = "";
return new Promise(function(resolve, reject) {
RNFetchBlob.fs.readStream(path, encoding, 102400).then(ifstream => {
ifstream.open();
ifstream.onData(chunk => {
data += chunk;
});
ifstream.onError(err => {
console.warn("readStream error", err);
return resolve(false);
});
ifstream.onEnd(() => {
return resolve(data);
});
});
});
}
Version :
"rn-fetch-blob": {
"version": "0.10.15",
"resolved": "https://registry.npmjs.org/rn-fetch-blob/-/rn-fetch-blob-0.10.15.tgz",
}
Any tips ?
thanks
mjmasn, berrtech, schekhlov and magrinj
Metadata
Metadata
Assignees
Labels
No labels