-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcopy-wasm.js
More file actions
30 lines (25 loc) · 791 Bytes
/
copy-wasm.js
File metadata and controls
30 lines (25 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import fs from 'fs';
import path from 'path';
const srcDirs = [
'node_modules/@mediapipe/tasks-audio/wasm',
'node_modules/@mediapipe/tasks-vision/wasm',
'node_modules/@mediapipe/tasks-text/wasm',
];
const destDir = 'public/wasm';
if (!fs.existsSync(destDir)) {
fs.mkdirSync(destDir, { recursive: true });
}
srcDirs.forEach(srcDir => {
if (fs.existsSync(srcDir)) {
const files = fs.readdirSync(srcDir);
files.forEach(file => {
const srcFile = path.join(srcDir, file);
const destFile = path.join(destDir, file);
fs.copyFileSync(srcFile, destFile);
console.log(`Copied ${srcFile} to ${destFile}`);
});
} else {
console.warn(`Source directory does not exist: ${srcDir}`);
}
});
console.log('Successfully prepared WASM static assets.');