codesandbox-importers icon indicating copy to clipboard operation
codesandbox-importers copied to clipboard

Is there a way to upload assets in post request without using a URL?

Open tenzyu opened this issue 1 year ago • 0 comments

Hello.

I would like to create a CodeSandbox with some assets that are not hosted anywhere using define api. So I want to use something like Uint8Array and datauri. As follows.

const parameters = getParameters({
  files: {
    "package.json": {
      content: {
        dependencies: {
          react: "latest",
          "react-dom": "latest",
        },
      },
    } as any,
    "fromDataURI.png": {
      content:
        "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
      isBinary: true, // something else
    },
    "fromBuffer.jpg": {
      content: someUint8Array,
      isBinary: true,
    },
  },
});

Is there plan to realize these or any ways which we can be replicated?

tenzyu avatar Oct 07 '22 05:10 tenzyu