diachedelic / capacitor-blob-writer

Capacitor plugin to write binary data to the filesystem
MIT License
132 stars 17 forks source link

E/Capacitor/BlobWriter: failed to move file into place #21

Closed djflip2016 closed 3 years ago

djflip2016 commented 4 years ago

any ideas as to why i would get this error here is a code snippet: and yes the directory exists const res = await fetch('https://cdn.vox-cdn.com/thumbor/Ous3VQj1sn4tvb3H13rIu8eGoZs=/0x0:2012x1341/1400x788/filters:focal(0x0:2012x1341):format(jpeg)/cdn.vox-cdn.com/uploads/chorus_image/image/47070706/google2.0.0.jpg'); const blob = await res.blob();

const { uri } = await writeFile({
  path: 'workbay',
  directory: FilesystemDirectory.Documents,

  // data must be a Blob (creating a Blob which wraps other data types
  // is trivial)
  data: blob,

  // create intermediate directories if they don't already exist
  // default: false
  recursive: true,

  // fallback to Filesystem.writeFile instead of throwing an error
  // (you may also specify a unary callback, which takes an Error and returns
  // a boolean)
  // default: true
});

}

diachedelic commented 4 years ago

Looks like this may be a duplicate of #19 - does your write succeed if you use Filesystem.writeFile instead of this plugin?

djflip2016 commented 4 years ago

yes im not getting nay errors do you happen to know where i could possibly view this file on the android emulator because it isnt showing any fails with the .data extension but how would i view that directory?

diachedelic commented 4 years ago

I've never tried using the emulator, it doesn't work very well on my computer. However, you could read it within your app with Filesystem.readFile or

const { uri } = await Filesystem.stat({ directory, path });
const response = await fetch(Capacitor.convertFileSrc(uri));