With this code:
const response = await http.request({
url: "https://raw.githubusercontent.com/NativeScript/NativeScript/master/apps/tests/logo.png",
method: "GET",
});
const filePath = fs.path.join(fs.knownFolders.temp().path, "test", "logo.png");
const file = response.content.toFile(filePath);
console.log("FILE LENGTH: " + file.readSync().length);
The file length that gets logged is 0.
While the following code:
const response = await http.request({
url: "https://raw.githubusercontent.com/NativeScript/NativeScript/master/apps/tests/logo.png",
method: "GET",
});
const file = fs.knownFolders.temp().getFolder("test1").getFile("logo.png");
response.content.toFile(file.path);
console.log("FILE LENGTH: " + file.readSync().length);
Works ok and the file length is non-zero.
I would expect when the file does not exists the method to automatically create the file and write the contents to the file.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Reactions are currently unavailable
With this code:
The file length that gets logged is 0.
While the following code:
Works ok and the file length is non-zero.
I would expect when the file does not exists the method to automatically create the file and write the contents to the file.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.