Add .gitignore to exclude all node packages and lock files
This commit is contained in:
Generated
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
let sessionId = null;
|
||||
const getPrefix = () => {
|
||||
if (!sessionId) {
|
||||
sessionId = crypto.randomUUID();
|
||||
}
|
||||
return `__remotion_render:${sessionId}:`;
|
||||
};
|
||||
export const cleanupStaleOpfsFiles = async () => {
|
||||
try {
|
||||
const root = await navigator.storage.getDirectory();
|
||||
for await (const [name] of root.entries()) {
|
||||
if (name.startsWith('__remotion_render:') &&
|
||||
!name.startsWith(getPrefix())) {
|
||||
await root.removeEntry(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (_a) {
|
||||
// Ignore, could already be closed
|
||||
}
|
||||
};
|
||||
export const createWebFsTarget = async () => {
|
||||
const directoryHandle = await navigator.storage.getDirectory();
|
||||
const filename = `${getPrefix()}${crypto.randomUUID()}`;
|
||||
const fileHandle = await directoryHandle.getFileHandle(filename, {
|
||||
create: true,
|
||||
});
|
||||
const writable = await fileHandle.createWritable();
|
||||
const stream = new WritableStream({
|
||||
async write(chunk) {
|
||||
await writable.seek(chunk.position);
|
||||
await writable.write(chunk);
|
||||
},
|
||||
});
|
||||
const getBlob = async () => {
|
||||
const handle = await directoryHandle.getFileHandle(filename);
|
||||
return handle.getFile();
|
||||
};
|
||||
const close = () => writable.close();
|
||||
return { stream, getBlob, close };
|
||||
};
|
||||
Reference in New Issue
Block a user