sandpack
sandpack copied to clipboard
Accept Uint8Array as file code input
Tell us how you think we can improve Sandpack
Packages affected
- [x] sandpack-client
- [x] sandpack-react
What is this feature?
nodebox accepts both string and Uint8Array to initialize its file system. Change sandpack-client and sandpack-react API to support it too.
This is useful to make sandpack as closely as possible to local development setup. For example to include static files in public directory directly inside nodebox such as gltf object for three.js.
How would your idea work?
Pass in files to SandpackProvider in either string or Uint8Array format.
Do you have any examples of how you would like to see us implement it?
Change the types and pass the files as is for nodebox runtime and either convert Uint8Array to utf-8 string or throw error for non-nodebox runtime.
I'll try to submit a PR.
This is a valid point, and I would love to have it on Sandpack. I have added your feature request to our internal backlog, which we use to prioritize what to build next. We can't make any promises about the timing, but it's on the list! If you'd like to work on this feature with us, please create a pull request, and we'll help you along the way.