Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

showSaveFilePicker: writable.write with position would resulting wierd file #72

Open
DeltaLaboratory opened this issue Mar 7, 2024 · 0 comments

Comments

@DeltaLaboratory
Copy link

import {
  showSaveFilePicker
} from 'native-file-system-adapter';

let file = await showSaveFilePicker({
  suggestedName: fileMeta.name
});
const writable = await file.createWritable();
let promises = [];
for (let i = 0; i < 10; i++) {
  // recieve some file at buffer 
  promises.push(new Promise(async (r) => {
      await writable.write({
        type: 'write',
        data: buffer,
        position: i * 1024 * 1024 * 100
      });
      r();
    })
  })
}

await Promise.all(promises)
await writable.close();

Browser: Firefox 123.01, Chrome mobile etc -> browsers not supporting showSaveFilePicker natively

will resulting partially written file. it may be impossible to implement this in current fallback but i didnt really read library code so just create issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant