UNPKG

emscripten-wasm-loader

Version:

Common interface to load wasm module into isomorphic environment

29 lines 749 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * `mkdir -p` implementation for wasm FS.mkdir interface. * dirPath param should be unixified. */ const mkdirTree = (FS, dirPath) => { const mkdir = (path) => { try { FS.mkdir(path); } catch (e) { //throw if not ERRNO_CODES.EEXIST if (e.errno != 17) { throw e; } } }; dirPath .split('/') .filter(x => !!x) .reduce((acc, value) => { acc.push(`${acc.length > 0 ? acc[acc.length - 1] : ''}/${value}`); return acc; }, []) .forEach(mkdir); }; exports.mkdirTree = mkdirTree; //# sourceMappingURL=mkdirTree.js.map