init commit
This commit is contained in:
24
remotion/node_modules/@remotion/studio/dist/api/write-static-file.js
generated
vendored
Normal file
24
remotion/node_modules/@remotion/studio/dist/api/write-static-file.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.writeStaticFile = void 0;
|
||||
const writeStaticFile = async ({ contents, filePath, }) => {
|
||||
if (window.remotion_isReadOnlyStudio) {
|
||||
throw new Error('writeStaticFile() is not available in read-only Studio');
|
||||
}
|
||||
const url = new URL(`${window.remotion_staticBase}/api/add-asset`, window.location.origin);
|
||||
if (filePath.includes('\\')) {
|
||||
return Promise.reject(new Error('File path cannot contain backslashes'));
|
||||
}
|
||||
url.search = new URLSearchParams({
|
||||
filePath,
|
||||
}).toString();
|
||||
const response = await fetch(url, {
|
||||
method: 'POST',
|
||||
body: contents,
|
||||
});
|
||||
if (!response.ok) {
|
||||
const jsonResponse = await response.json();
|
||||
throw new Error(jsonResponse.error);
|
||||
}
|
||||
};
|
||||
exports.writeStaticFile = writeStaticFile;
|
||||
Reference in New Issue
Block a user