Home | History | Annotate | Download | only in embenchen

Lines Matching refs:FS

37     Module["preRun"].push(runWithFS); // FS is not initialized yet, wait for it
89 var nodeFS = require('fs');
1534 var path = (i >= 0) ? arguments[i] : FS.cwd();
1586 // // currently, FS.init does not distinguish if process.stdin is a file or TTY
1589 // // with text files until FS.init can be refactored.
1604 FS.registerDevice(dev, TTY.stream_ops);
1608 throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
1619 throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
1627 throw new FS.ErrnoError(ERRNO_CODES.EIO);
1630 throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
1642 throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
1648 throw new FS.ErrnoError(ERRNO_CODES.EIO);
1705 if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
1707 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
1753 stream: FS.chrdev_stream_ops
1757 var node = FS.createNode(parent, name, mode, dev);
1758 if (FS.isDir(node.mode)) {
1762 } else if (FS.isFile(node.mode)) {
1767 } else if (FS.isLink(node.mode)) {
1770 } else if (FS.isChrdev(node.mode)) {
1789 attr.dev = FS.isChrdev(node.mode) ? node.id : 1;
1796 if (FS.isDir(node.mode)) {
1798 } else if (FS.isFile(node.mode)) {
1800 } else if (FS.isLink(node.mode)) {
1827 throw FS.genericErrors[ERRNO_CODES.ENOENT];
1832 if (FS.isDir(old_node.mode)) {
1835 new_node = FS.lookupNode(new_dir, new_name);
1840 throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
1852 var node = FS.lookupNode(parent, name);
1854 throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
1871 if (!FS.isLink(node.mode)) {
1872 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
1917 if (FS.isFile(stream.node.mode)) {
1922 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
1933 if (!FS.isFile(stream.node.mode)) {
1934 throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
1958 throw new FS.ErrnoError(ERRNO_CODES.ENOMEM);
2032 var check = FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint));
2039 stat = FS.stat(path);
2044 if (FS.isDir(stat.mode)) {
2045 check.push.apply(check, FS.readdir(path).filter(isRealDir).map(toAbsolute(path)));
2080 var lookup = FS.lookupPath(path);
2082 stat = FS.stat(path);
2087 if (FS.isDir(stat.mode)) {
2089 } else if (FS.isFile(stat.mode)) {
2096 if (FS.isDir(entry.mode)) {
2097 FS.mkdir(path, entry.mode);
2098 } else if (FS.isFile(entry.mode)) {
2099 FS.writeFile(path, entry.contents, { encoding: 'binary', canOwn: true });
2104 FS.utime(path, entry.timestamp, entry.timestamp);
2112 var lookup = FS.lookupPath(path);
2113 var stat = FS.stat(path);
2115 if (FS.isDir(stat.mode)) {
2116 FS.rmdir(path);
2117 } else if (FS.isFile(stat.mode)) {
2118 FS.unlink(path);
2218 if (!FS.isDir(mode) && !FS.isFile(mode) && !FS.isLink(mode)) {
2219 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
2221 var node = FS.createNode(parent, name, mode);
2228 stat = fs.lstatSync(path);
2236 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2258 stat = fs.lstatSync(path);
2261 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2290 fs.chmodSync(path, attr.mode);
2296 fs.utimesSync(path, date, date);
2299 fs.truncateSync(path, attr.size);
2303 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2311 // create the backing node for this in the fs root as well
2314 if (FS.isDir(node.mode)) {
2315 fs.mkdirSync(path, node.mode);
2317 fs.writeFileSync(path, '', { mode: node.mode });
2321 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2328 fs.renameSync(oldPath, newPath);
2331 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2336 fs.unlinkSync(path);
2339 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2344 fs.rmdirSync(path);
2347 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2352 return fs.readdirSync(path);
2355 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2360 fs.symlinkSync(oldPath, newPath);
2363 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2368 return fs.readlinkSync(path);
2371 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2376 if (FS.isFile(stream.node.mode)) {
2377 stream.nfd = fs.openSync(path, NODEFS.flagsToPermissionString(stream.flags));
2381 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2385 if (FS.isFile(stream.node.mode) && stream.nfd) {
2386 fs.closeSync(stream.nfd);
2390 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2397 res = fs.readSync(stream.nfd, nbuffer, 0, length, position);
2399 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2412 res = fs.writeSync(stream.nfd, nbuffer, 0, length, position);
2414 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2422 if (FS.isFile(stream.node.mode)) {
2424 var stat = fs.fstatSync(stream.nfd);
2427 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2433 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
2450 }var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},handleFSError:function (e) {
2451 if (!(e instanceof FS.ErrnoError)) throw e + ' : ' + stackTrace();
2454 path = PATH.resolve(FS.cwd(), path);
2468 throw new FS.ErrnoError(ERRNO_CODES.ELOOP);
2477 var current = FS.root;
2487 current = FS.lookupNode(current, parts[i]);
2491 if (FS.isMountpoint(current)) {
2501 while (FS.isLink(current.mode)) {
2502 var link = FS.readlink(current_path);
2505 var lookup = FS.lookupPath(current_path, { recurse_count: opts.recurse_count });
2509 throw new FS.ErrnoError(ERRNO_CODES.ELOOP);
2519 if (FS.isRoot(node)) {
2534 return ((parentid + hash) >>> 0) % FS.nameTable.length;
2536 var hash = FS.hashName(node.parent.id, node.name);
2537 node.name_next = FS.nameTable[hash];
2538 FS.nameTable[hash] = node;
2540 var hash = FS.hashName(node.parent.id, node.name);
2541 if (FS.nameTable[hash] === node) {
2542 FS.nameTable[hash] = node.name_next;
2544 var current = FS.nameTable[hash];
2554 var err = FS.mayLookup(parent);
2556 throw new FS.ErrnoError(err);
2558 var hash = FS.hashName(parent.id, name);
2559 for (var node = FS.nameTable[hash]; node; node = node.name_next) {
2566 return FS.lookup(parent, name);
2568 if (!FS.FSNode) {
2569 FS.FSNode = function(parent, name, mode, rdev) {
2576 this.id = FS.nextInode++;
2584 FS.FSNode.prototype = {};
2592 Object.defineProperties(FS.FSNode.prototype, {
2602 get: function() { return FS.isDir(this.mode); },
2605 get: function() { return FS.isChrdev(this.mode); },
2610 var node = new FS.FSNode(parent, name, mode, rdev);
2612 FS.hashAddNode(node);
2616 FS.hashRemoveNode(node);
2636 var flags = FS.flagModes[str];
2649 if (FS.ignorePermissions) {
2662 return FS.nodePermissions(dir, 'x');
2665 var node = FS.lookupNode(dir, name);
2669 return FS.nodePermissions(dir, 'wx');
2673 node = FS.lookupNode(dir, name);
2677 var err = FS.nodePermissions(dir, 'wx');
2682 if (!FS.isDir(node.mode)) {
2685 if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) {
2689 if (FS.isDir(node.mode)) {
2698 if (FS.isLink(node.mode)) {
2700 } else if (FS.isDir(node.mode)) {
2706 return FS.nodePermissions(node, FS.flagsToPermissionString(flags));
2709 fd_end = fd_end || FS.MAX_OPEN_FDS;
2711 if (!FS
2715 throw new FS.ErrnoError(ERRNO_CODES.EMFILE);
2717 return FS.streams[fd];
2719 if (!FS.FSStream) {
2720 FS.FSStream = function(){};
2721 FS.FSStream.prototype = {};
2723 Object.defineProperties(FS.FSStream.prototype, {
2741 stream.__proto__ = FS.FSStream.prototype;
2743 var newStream = new FS.FSStream();
2749 var fd = FS.nextfd(fd_start, fd_end);
2751 FS.streams[fd] = stream;
2754 FS.streams[fd] = null;
2756 return FS.streams[ptr - 1];
2760 var device = FS.getDevice(stream.node.rdev);
2768 throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
2776 FS.devices[dev] = { stream_ops: ops };
2778 return FS.devices[dev];
2798 var mounts = FS.getMounts(FS.root.mount);
2826 if (root && FS.root) {
2827 throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
2829 var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
2834 if (FS.isMountpoint(node)) {
2835 throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
2838 if (!FS.isDir(node.mode)) {
2839 throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
2850 // create a root node for the fs
2856 FS.root = mountRoot;
2869 var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
2871 if (!FS.isMountpoint(lookup.node)) {
2872 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
2878 var mounts = FS.getMounts(mount);
2880 Object.keys(FS.nameTable).forEach(function (hash) {
2881 var current = FS.nameTable[hash];
2887 FS.destroyNode(current);
2904 var lookup = FS.lookupPath(path, { parent: true });
2907 var err = FS.mayCreate(parent, name);
2909 throw new FS.ErrnoError(err);
2912 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
2919 return FS.mknod(path, mode, 0);
2924 return FS.mknod(path, mode, 0);
2931 return FS.mknod(path, mode, dev);
2933 var lookup = FS.lookupPath(newpath, { parent: true });
2936 var err = FS.mayCreate(parent, newname);
2938 throw new FS.ErrnoError(err);
2941 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
2952 lookup = FS.lookupPath(old_path, { parent: true });
2954 lookup = FS.lookupPath(new_path, { parent: true });
2957 throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
2961 throw new FS.ErrnoError(ERRNO_CODES.EXDEV);
2964 var old_node = FS.lookupNode(old_dir, old_name);
2968 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
2973 throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
2978 new_node = FS.lookupNode(new_dir, new_name);
2987 var isdir = FS.isDir(old_node.mode);
2988 var err = FS.mayDelete(old_dir, old_name, isdir);
2990 throw new FS.ErrnoError(err);
2995 FS.mayDelete(new_dir, new_name, isdir) :
2996 FS.mayCreate(new_dir, new_name);
2998 throw new FS.ErrnoError(err);
3001 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
3003 if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) {
3004 throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
3008 err = FS.nodePermissions(old_dir, 'w');
3010 throw new FS.ErrnoError(err);
3014 FS.hashRemoveNode(old_node);
3015 // do the underlying fs rename
3023 FS.hashAddNode(old_node);
3026 var lookup = FS.lookupPath(path, { parent: true });
3029 var node = FS.lookupNode(parent, name);
3030 var err = FS.mayDelete(parent, name, true);
3032 throw new FS.ErrnoError(err);
3035 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
3037 if (FS.isMountpoint(node)) {
3038 throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
3041 FS.destroyNode(node);
3043 var lookup = FS.lookupPath(path, { follow: true });
3046 throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
3050 var lookup = FS.lookupPath(path, { parent: true });
3053 var node = FS.lookupNode(parent, name);
3054 var err = FS.mayDelete(parent, name, false);
3058 throw new FS.ErrnoError(err);
3061 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
3063 if (FS.isMountpoint(node)) {
3064 throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
3067 FS.destroyNode(node);
3069 var lookup = FS.lookupPath(path);
3072 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3076 var lookup = FS.lookupPath(path, { follow: !dontFollow });
3079 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
3083 return FS.stat(path, true);
3087 var lookup = FS.lookupPath(path, { follow: !dontFollow });
3093 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
3100 FS.chmod(path, mode, true);
3102 var stream = FS.getStream(fd);
3104 throw new FS.ErrnoError(ERRNO_CODES.EBADF);
3106 FS.chmod(stream.node, mode);
3110 var lookup = FS.lookupPath(path, { follow: !dontFollow });
3116 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
3123 FS.chown(path, uid, gid, true);
3125 var stream = FS.getStream(fd);
3127 throw new FS.ErrnoError(ERRNO_CODES.EBADF);
3129 FS.chown(stream.node, uid, gid);
3132 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3136 var lookup = FS.lookupPath(path, { follow: true });
3142 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
3144 if (FS.isDir(node.mode)) {
3145 throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
3147 if (!FS.isFile(node.mode)) {
3148 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3150 var err = FS.nodePermissions(node, 'w');
3152 throw new FS.ErrnoError(err);
3159 var stream = FS.getStream(fd);
3161 throw new FS.ErrnoError(ERRNO_CODES.EBADF);
3164 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3166 FS.truncate(stream.node, len);
3168 var lookup = FS.lookupPath(path, { follow: true });
3174 flags = typeof flags === 'string' ? FS.modeStringToFlags(flags) : flags;
3187 var lookup = FS.lookupPath(path, {
3200 throw new FS
3204 node = FS.mknod(path, mode, 0);
3208 throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
3211 if (FS.isChrdev(node.mode)) {
3215 var err = FS.mayOpen(node, flags);
3217 throw new FS.ErrnoError(err);
3221 FS.truncate(node, 0);
3227 var stream = FS.createStream({
3229 path: FS.getPath(node), // we want the absolute path to the node
3243 if (!FS.readFiles) FS.readFiles = {};
3244 if (!(path in FS.readFiles)) {
3245 FS.readFiles[path] = 1;
3258 FS.closeStream(stream.fd);
3262 throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
3267 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3270 throw new FS.ErrnoError(ERRNO_CODES.EBADF);
3272 if (FS.isDir(stream.node.mode)) {
3273 throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
3276 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3283 throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
3290 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3293 throw new FS.ErrnoError(ERRNO_CODES.EBADF);
3295 if (FS.isDir(stream.node.mode)) {
3296 throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
3299 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3306 throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
3310 FS.llseek(stream, 0, 2);
3317 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3320 throw new FS.ErrnoError(ERRNO_CODES.EBADF);
3322 if (!FS.isFile(stream.node.mode) && !FS.isDir(node.mode)) {
3323 throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
3326 throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP);
3332 throw new FS.ErrnoError(ERRNO_CODES.EACCES);
3335 throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
3340 throw new FS.ErrnoError(ERRNO_CODES.ENOTTY);
3351 var stream = FS.open(path, opts.flags);
3352 var stat = FS.stat(path);
3355 FS.read(stream, buf, 0, length, 0);
3365 FS.close(stream);
3374 var stream = FS.open(path, opts.flags, opts.mode);
3378 FS.write(stream, buf, 0, buf.length, 0, opts.canOwn);
3380 FS.write(stream, data, 0, data.length, 0, opts.canOwn);
3382 FS.close(stream);
3384 return FS.currentPath;
3386 var lookup = FS.lookupPath(path, { follow: true });
3387 if (!FS.isDir(lookup.node.mode)) {
3388 throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
3390 var err = FS.nodePermissions(lookup.node, 'x');
3392 throw new FS.ErrnoError(err);
3394 FS.currentPath = lookup.path;
3396 FS.mkdir('/tmp');
3399 FS.mkdir('/dev');
3401 FS.registerDevice(FS.makedev(1, 3), {
3405 FS.mkdev('/dev/null', FS.makedev(1, 3));
3409 TTY.register(FS.makedev(5, 0), TTY.default_tty_ops);
3410 TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops);
3411 FS.mkdev('/dev/tty', FS.makedev(5, 0));
3412 FS.mkdev('/dev/tty1', FS.makedev(6, 0));
3415 FS.mkdir('/dev/shm');
3416 FS.mkdir('/dev/shm/tmp');
3419 // input / output callback and that utilizes FS.createDevice
3427 FS.createDevice('/dev', 'stdin', Module['stdin']);
3429 FS.symlink('/dev/tty', '/dev/stdin');
3432 FS.createDevice('/dev', 'stdout', null, Module['stdout']);
3434 FS.symlink('/dev/tty', '/dev/stdout');
3437 FS.createDevice('/dev', 'stderr', null, Module['stderr']);
3439 FS.symlink('/dev/tty1', '/dev/stderr');
3443 var stdin = FS.open('/dev/stdin', 'r');
3444 HEAP32[((_stdin)>>2)]=FS.getPtrForStream(stdin);
3447 var stdout = FS.open('/dev/stdout', 'w');
3448 HEAP32[((_stdout)>>2)]=FS.getPtrForStream(stdout);
3451 var stderr = FS.open('/dev/stderr', 'w');
3452 HEAP32[((_stderr)>>2)]=FS.getPtrForStream(stderr);
3455 if (FS.ErrnoError) return;
3456 FS.ErrnoError = function ErrnoError(errno) {
3466 FS.ErrnoError.prototype = new Error();
3467 FS.ErrnoError.prototype.constructor = FS.ErrnoError;
3470 FS.genericErrors[code] = new FS.ErrnoError(code);
3471 FS.genericErrors[code].stack = '<generic error, no stack>';
3474 FS.ensureErrnoError();
3476 FS.nameTable = new Array(4096);
3478 FS.mount(MEMFS, {}, '/');
3480 FS.createDefaultDirectories();
3481 FS.createDefaultDevices();
3483 assert(!FS.init.initialized, 'FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)');
3484 FS.init.initialized = true;
3486 FS.ensureErrnoError();
3493 FS.createStandardStreams();
3495 FS.init.initialized = false;
3496 for (var i = 0; i < FS.streams.length; i++) {
3497 var stream = FS.streams[i];
3501 FS.close(stream);
3517 var ret = FS.analyzePath(path, dontResolveLastLink);
3527 var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
3536 var lookup = FS.lookupPath(path, { parent: true });
3541 lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
3552 var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
3553 var mode = FS.getMode(canRead, canWrite);
3554 return FS.mkdir(path, mode);
3556 parent = typeof parent === 'string' ? parent : FS.getPath(parent);
3563 FS.mkdir(current);
3571 var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
3572 var mode = FS.getMode(canRead, canWrite);
3573 return FS.create(path, mode);
3575 var path = name ? PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name) : parent;
3576 var mode = FS.getMode(canRead, canWrite);
3577 var node = FS.create(path, mode);
3585 FS.chmod(node, mode | 146);
3586 var stream = FS.open(node, 'w');
3587 FS.write(stream, data, 0, data.length, 0, canOwn);
3588 FS.close(stream);
3589 FS.chmod(node, mode);
3593 var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
3594 var mode = FS.getMode(!!input, !!output);
3595 if (!FS.createDevice.major) FS.createDevice.major = 64;
3596 var dev = FS.makedev(FS.createDevice.major++, 0);
3599 FS.registerDevice(dev, {
3616 throw new FS.ErrnoError(ERRNO_CODES.EIO);
3619 throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
3635 throw new FS.ErrnoError(ERRNO_CODES.EIO);
3644 return FS.mkdev(path, mode, dev);
3646 var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
3647 return FS.symlink(target, path);
3762 var node = FS.createFile(parent, name, properties, canRead, canWrite);
3778 if (!FS.forceLoadFile(node)) {
3779 throw new FS.ErrnoError(ERRNO_CODES.EIO);
3786 if (!FS.forceLoadFile(node)) {
3787 throw new FS.ErrnoError(ERRNO_CODES.EIO);
3815 FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn);
3848 var indexedDB = FS.indexedDB();
3850 var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
3857 db.createObjectStore(FS.DB_STORE_NAME);
3861 var transaction = db.transaction([FS.DB_STORE_NAME], 'readwrite');
3862 var files = transaction.objectStore(FS.DB_STORE_NAME);
3868 var putRequest = files.put(FS.analyzePath(path).object.contents, path);
3878 var indexedDB = FS.indexedDB();
3880 var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
3888 var transaction = db.transaction([FS.DB_STORE_NAME], 'readonly');
3893 var files = transaction.objectStore(FS.DB_STORE_NAME);
3901 if (FS.analyzePath(path).exists) {
3902 FS.unlink(path);
3904 FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true);
3918 var stream = FS.getStream(fildes);
3924 return FS.llseek(stream, offset, whence);
3926 FS.handleFSError(e);
3934 stream = FS.getStreamFromPtr(stream);
3945 stream = FS.getStreamFromPtr(stream);
3965 var stream = FS.getStream(fildes);
3971 FS.close(stream);
3974 FS.handleFSError(e);
3982 var stream = FS.getStream(fildes);
4003 return FS.createNode(null, '/', 16384 | 511 /* 0777 */, 0);
4024 var node = FS.createNode(SOCKFS.root, name, 49152, 0);
4029 var stream = FS.createStream({
4032 flags: FS.modeStringToFlags('r+'),
4043 var stream = FS.getStream(fd);
4044 if (!stream || !FS.isSocket(stream.node.mode)) {
4141 throw new FS.ErrnoError(ERRNO_CODES.EHOSTUNREACH);
4295 throw new FS.ErrnoError(ERRNO_CODES.EINVAL); // already bound
4313 if (!(e instanceof FS.ErrnoError)) throw e;
4319 throw new FS.ErrnoError(ERRNO_CODS.EOPNOTSUPP);
4331 throw new FS.ErrnoError(ERRNO_CODES.EALREADY);
4333 throw new FS.ErrnoError(ERRNO_CODES.EISCONN);
4345 throw new FS.ErrnoError(ERRNO_CODES.EINPROGRESS);
4348 throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP);
4351 throw new FS.ErrnoError(ERRNO_CODES.EINVAL); // already listening
4387 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
4396 throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
4417 throw new FS.ErrnoError(ERRNO_CODES.EDESTADDRREQ);
4431 throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
4433 throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
4466 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
4472 throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
4482 throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
4490 throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
4493 throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
4531 var stream = FS.getStream(fildes);
4538 return FS.read(stream, slab, buf, nbyte, offset);
4540 FS.handleFSError(e);
4546 var stream = FS.getStream(fildes);
4555 return FS.read(stream, slab, buf, nbyte);
4557 FS.handleFSError(e);
4568 var streamObj = FS.getStreamFromPtr(stream);
4604 var stream = FS.open(path, oflag, mode);
4607 FS.handleFSError(e);
4642 return fd === -1 ? 0 : FS.getPtrForStream(FS.getStream(fd));
4662 var stream = FS.getStream(fildes);
4669 return FS.write(stream, slab, buf, nbyte, offset);
4671 FS.handleFSError(e);
4677 var stream = FS.getStream(fildes);
4686 return FS.write(stream, slab, buf, nbyte);
4688 FS.handleFSError(e);
4699 var streamObj = FS.getStreamFromPtr(stream);
4727 var streamObj = FS.getStreamFromPtr(stream);
4818 var folder = FS.findObject(dir || '/tmp');
4821 folder = FS.findObject(dir);
5746 var streamObj = FS.getStreamFromPtr(stream);
5763 stream = FS.getStreamFromPtr(stream);
5778 var streamObj = FS.getStreamFromPtr(stream);
5824 FS.unlink(path);
5827 FS.handleFSError(e);
5837 FS.rmdir(path);
5840 FS.handleFSError(e);
5855 var streamObj = FS.getStreamFromPtr(stream);
5875 FS.rename(old_path, new_path);
5878 FS.handleFSError(e);
6467 var streamObj = FS.getStreamFromPtr(stream);
6495 stream = FS.getStreamFromPtr(stream);
6507 stream = FS.getStreamFromPtr(stream);
6541 stream = FS.getStreamFromPtr(stream);
6546 if (FS.isChrdev(stream.node.mode)) {
6603 stream = FS.getStreamFromPtr(stream);
7119 FS.staticInit();__ATINIT__.unshift({ func: function() { if (!Module["noFSInit"] && !FS.init.initialized) FS.init() } });__ATMAIN__.push({ func: function() { FS.ignorePermissions = false } });__ATEXIT__.push({ func: function() { FS.quit() } });Module["FS_createFolder"] = FS.createFolder;Module["FS_createPath"] = FS.createPath;Module["FS_createDataFile"] = FS.createDataFile;Module["FS_createPreloadedFile"] = FS.createPreloadedFile;Module["FS_createLazyFile"] = FS.createLazyFile;Module["FS_createLink"] = FS.createLink;Module["FS_createDevice"] = FS.createDevice;
7122 if (ENVIRONMENT_IS_NODE) { var fs = require("fs"); NODEFS.staticInit(); }
7123 __ATINIT__.push({ func: function() { SOCKFS.root = FS.mount(SOCKFS, {}, null); } });