Home | History | Annotate | Download | only in embenchen

Lines Matching refs:FS

57   var nodeFS = require('fs');
1497 var path = (i >= 0) ? arguments[i] : FS.cwd();
1549 // // currently, FS.init does not distinguish if process.stdin is a file or TTY
1552 // // with text files until FS.init can be refactored.
1567 FS.registerDevice(dev, TTY.stream_ops);
1571 throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
1582 throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
1590 throw new FS.ErrnoError(ERRNO_CODES.EIO);
1593 throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
1605 throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
1611 throw new FS.ErrnoError(ERRNO_CODES.EIO);
1668 if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
1670 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
1716 stream: FS.chrdev_stream_ops
1720 var node = FS.createNode(parent, name, mode, dev);
1721 if (FS.isDir(node.mode)) {
1725 } else if (FS.isFile(node.mode)) {
1730 } else if (FS.isLink(node.mode)) {
1733 } else if (FS.isChrdev(node.mode)) {
1752 attr.dev = FS.isChrdev(node.mode) ? node.id : 1;
1759 if (FS.isDir(node.mode)) {
1761 } else if (FS.isFile(node.mode)) {
1763 } else if (FS.isLink(node.mode)) {
1790 throw FS.genericErrors[ERRNO_CODES.ENOENT];
1795 if (FS.isDir(old_node.mode)) {
1798 new_node = FS.lookupNode(new_dir, new_name);
1803 throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
1815 var node = FS.lookupNode(parent, name);
1817 throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
1834 if (!FS.isLink(node.mode)) {
1835 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
1880 if (FS.isFile(stream.node.mode)) {
1885 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
1896 if (!FS.isFile(stream.node.mode)) {
1897 throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
1921 throw new FS.ErrnoError(ERRNO_CODES.ENOMEM);
1995 var check = FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint));
2002 stat = FS.stat(path);
2007 if (FS.isDir(stat.mode)) {
2008 check.push.apply(check, FS.readdir(path).filter(isRealDir).map(toAbsolute(path)));
2043 var lookup = FS.lookupPath(path);
2045 stat = FS.stat(path);
2050 if (FS.isDir(stat.mode)) {
2052 } else if (FS.isFile(stat.mode)) {
2059 if (FS.isDir(entry.mode)) {
2060 FS.mkdir(path, entry.mode);
2061 } else if (FS.isFile(entry.mode)) {
2062 FS.writeFile(path, entry.contents, { encoding: 'binary', canOwn: true });
2067 FS.utime(path, entry.timestamp, entry.timestamp);
2075 var lookup = FS.lookupPath(path);
2076 var stat = FS.stat(path);
2078 if (FS.isDir(stat.mode)) {
2079 FS.rmdir(path);
2080 } else if (FS.isFile(stat.mode)) {
2081 FS.unlink(path);
2181 if (!FS.isDir(mode) && !FS.isFile(mode) && !FS.isLink(mode)) {
2182 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
2184 var node = FS.createNode(parent, name, mode);
2191 stat = fs.lstatSync(path);
2199 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2221 stat = fs.lstatSync(path);
2224 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2253 fs.chmodSync(path, attr.mode);
2259 fs.utimesSync(path, date, date);
2262 fs.truncateSync(path, attr.size);
2266 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2274 // create the backing node for this in the fs root as well
2277 if (FS.isDir(node.mode)) {
2278 fs.mkdirSync(path, node.mode);
2280 fs.writeFileSync(path, '', { mode: node.mode });
2284 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2291 fs.renameSync(oldPath, newPath);
2294 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2299 fs.unlinkSync(path);
2302 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2307 fs.rmdirSync(path);
2310 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2315 return fs.readdirSync(path);
2318 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2323 fs.symlinkSync(oldPath, newPath);
2326 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2331 return fs.readlinkSync(path);
2334 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2339 if (FS.isFile(stream.node.mode)) {
2340 stream.nfd = fs.openSync(path, NODEFS.flagsToPermissionString(stream.flags));
2344 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2348 if (FS.isFile(stream.node.mode) && stream.nfd) {
2349 fs.closeSync(stream.nfd);
2353 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2360 res = fs.readSync(stream.nfd, nbuffer, 0, length, position);
2362 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2375 res = fs.writeSync(stream.nfd, nbuffer, 0, length, position);
2377 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2385 if (FS.isFile(stream.node.mode)) {
2387 var stat = fs.fstatSync(stream.nfd);
2390 throw new FS.ErrnoError(ERRNO_CODES[e.code]);
2396 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
2413 }var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},handleFSError:function (e) {
2414 if (!(e instanceof FS.ErrnoError)) throw e + ' : ' + stackTrace();
2417 path = PATH.resolve(FS.cwd(), path);
2431 throw new FS.ErrnoError(ERRNO_CODES.ELOOP);
2440 var current = FS.root;
2450 current = FS.lookupNode(current, parts[i]);
2454 if (FS.isMountpoint(current)) {
2464 while (FS.isLink(current.mode)) {
2465 var link = FS.readlink(current_path);
2468 var lookup = FS.lookupPath(current_path, { recurse_count: opts.recurse_count });
2472 throw new FS.ErrnoError(ERRNO_CODES.ELOOP);
2482 if (FS.isRoot(node)) {
2497 return ((parentid + hash) >>> 0) % FS.nameTable.length;
2499 var hash = FS.hashName(node.parent.id, node.name);
2500 node.name_next = FS.nameTable[hash];
2501 FS.nameTable[hash] = node;
2503 var hash = FS.hashName(node.parent.id, node.name);
2504 if (FS.nameTable[hash] === node) {
2505 FS.nameTable[hash] = node.name_next;
2507 var current = FS.nameTable[hash];
2517 var err = FS.mayLookup(parent);
2519 throw new FS.ErrnoError(err);
2521 var hash = FS.hashName(parent.id, name);
2522 for (var node = FS.nameTable[hash]; node; node = node.name_next) {
2529 return FS.lookup(parent, name);
2531 if (!FS.FSNode) {
2532 FS.FSNode = function(parent, name, mode, rdev) {
2539 this.id = FS.nextInode++;
2547 FS.FSNode.prototype = {};
2555 Object.defineProperties(FS.FSNode.prototype, {
2565 get: function() { return FS.isDir(this.mode); },
2568 get: function() { return FS.isChrdev(this.mode); },
2573 var node = new FS.FSNode(parent, name, mode, rdev);
2575 FS.hashAddNode(node);
2579 FS.hashRemoveNode(node);
2599 var flags = FS.flagModes[str];
2612 if (FS.ignorePermissions) {
2625 return FS.nodePermissions(dir, 'x');
2628 var node = FS.lookupNode(dir, name);
2632 return FS.nodePermissions(dir, 'wx');
2636 node = FS.lookupNode(dir, name);
2640 var err = FS.nodePermissions(dir, 'wx');
2645 if (!FS.isDir(node.mode)) {
2648 if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) {
2652 if (FS.isDir(node.mode)) {
2661 if (FS.isLink(node.mode)) {
2663 } else if (FS.isDir(node.mode)) {
2669 return FS.nodePermissions(node, FS.flagsToPermissionString(flags));
2672 fd_end = fd_end || FS.MAX_OPEN_FDS;
2674 if (!FS.streams[fd]) {
2678 throw new FS.ErrnoError(ERRNO_CODES.EMFILE);
2680 return FS.streams[fd];
2682 if (!FS.FSStream) {
2683 FS.FSStream = function(){};
2684 FS.FSStream.prototype = {};
2686 Object.defineProperties(FS.FSStream.prototype, {
2704 stream.__proto__ = FS.FSStream.prototype;
2706 var newStream = new FS.FSStream();
2712 var fd = FS.nextfd(fd_start, fd_end);
2714 FS.streams[fd] = stream;
2717 FS.streams[fd] = null;
2719 return FS.streams[ptr - 1];
2723 var device = FS.getDevice(stream.node.rdev);
2731 throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
2739 FS.devices[dev] = { stream_ops: ops };
2741 return FS.devices[dev];
2761 var mounts = FS.getMounts(FS.root.mount);
2789 if (root && FS.root) {
2790 throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
2792 var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
2797 if (FS.isMountpoint(node)) {
2798 throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
2801 if (!FS.isDir(node.mode)) {
2802 throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
2813 // create a root node for the fs
2819 FS.root = mountRoot;
2832 var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
2834 if (!FS.isMountpoint(lookup.node)) {
2835 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
2841 var mounts = FS.getMounts(mount);
2843 Object.keys(FS.nameTable).forEach(function (hash) {
2844 var current = FS.nameTable[hash];
2850 FS.destroyNode(current);
2867 var lookup = FS.lookupPath(path, { parent: true });
2870 var err = FS.mayCreate(parent, name);
2872 throw new FS.ErrnoError(err);
2875 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
2882 return FS.mknod(path, mode, 0);
2887 return FS.mknod(path, mode, 0);
2894 return FS.mknod(path, mode, dev);
2896 var lookup = FS.lookupPath(newpath, { parent: true });
2899 var err = FS.mayCreate(parent, newname);
2901 throw new FS.ErrnoError(err);
2904 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
2915 lookup = FS.lookupPath(old_path, { parent: true });
2917 lookup = FS.lookupPath(new_path, { parent: true });
2920 throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
2924 throw new FS.ErrnoError(ERRNO_CODES.EXDEV);
2927 var old_node = FS.lookupNode(old_dir, old_name);
2931 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
2936 throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
2941 new_node = FS.lookupNode(new_dir, new_name);
2950 var isdir = FS.isDir(old_node.mode);
2951 var err = FS.mayDelete(old_dir, old_name, isdir);
2953 throw new FS.ErrnoError(err);
2958 FS.mayDelete(new_dir, new_name, isdir) :
2959 FS.mayCreate(new_dir, new_name);
2961 throw new FS.ErrnoError(err);
2964 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
2966 if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) {
2967 throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
2971 err = FS.nodePermissions(old_dir, 'w');
2973 throw new FS.ErrnoError(err);
2977 FS.hashRemoveNode(old_node);
2978 // do the underlying fs rename
2986 FS.hashAddNode(old_node);
2989 var lookup = FS.lookupPath(path, { parent: true });
2992 var node = FS.lookupNode(parent, name);
2993 var err = FS.mayDelete(parent, name, true);
2995 throw new FS.ErrnoError(err);
2998 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
3000 if (FS.isMountpoint(node)) {
3001 throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
3004 FS.destroyNode(node);
3006 var lookup = FS.lookupPath(path, { follow: true });
3009 throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
3013 var lookup = FS.lookupPath(path, { parent: true });
3016 var node = FS.lookupNode(parent, name);
3017 var err = FS.mayDelete(parent, name, false);
3021 throw new FS.ErrnoError(err);
3024 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
3026 if (FS.isMountpoint(node)) {
3027 throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
3030 FS.destroyNode(node);
3032 var lookup = FS.lookupPath(path);
3035 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3039 var lookup = FS.lookupPath(path, { follow: !dontFollow });
3042 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
3046 return FS.stat(path, true);
3050 var lookup = FS.lookupPath(path, { follow: !dontFollow });
3056 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
3063 FS.chmod(path, mode, true);
3065 var stream = FS.getStream(fd);
3067 throw new FS.ErrnoError(ERRNO_CODES.EBADF);
3069 FS.chmod(stream.node, mode);
3073 var lookup = FS.lookupPath(path, { follow: !dontFollow });
3079 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
3086 FS.chown(path, uid, gid, true);
3088 var stream = FS.getStream(fd);
3090 throw new FS.ErrnoError(ERRNO_CODES.EBADF);
3092 FS.chown(stream.node, uid, gid);
3095 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3099 var lookup = FS.lookupPath(path, { follow: true });
3105 throw new FS.ErrnoError(ERRNO_CODES.EPERM);
3107 if (FS.isDir(node.mode)) {
3108 throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
3110 if (!FS.isFile(node.mode)) {
3111 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3113 var err = FS.nodePermissions(node, 'w');
3115 throw new FS.ErrnoError(err);
3122 var stream = FS.getStream(fd);
3124 throw new FS.ErrnoError(ERRNO_CODES.EBADF);
3127 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3129 FS.truncate(stream.node, len);
3131 var lookup = FS.lookupPath(path, { follow: true });
3137 flags = typeof flags === 'string' ? FS.modeStringToFlags(flags) : flags;
3150 var lookup = FS.lookupPath(path, {
3163 throw new FS.ErrnoError(ERRNO_CODES.EEXIST);
3167 node = FS.mknod(path, mode, 0);
3171 throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
3174 if (FS.isChrdev(node.mode)) {
3178 var err = FS.mayOpen(node, flags);
3180 throw new FS.ErrnoError(err);
3184 FS.truncate(node, 0);
3190 var stream = FS.createStream({
3192 path: FS.getPath(node), // we want the absolute path to the node
3206 if (!FS.readFiles) FS.readFiles = {};
3207 if (!(path in FS.readFiles)) {
3208 FS.readFiles[path] = 1;
3221 FS.closeStream(stream.fd);
3225 throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
3230 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3233 throw new FS.ErrnoError(ERRNO_CODES.EBADF);
3235 if (FS.isDir(stream.node.mode)) {
3236 throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
3239 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3246 throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
3253 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3256 throw new FS.ErrnoError(ERRNO_CODES.EBADF);
3258 if (FS.isDir(stream.node.mode)) {
3259 throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
3262 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3269 throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
3273 FS.llseek(stream, 0, 2);
3280 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
3283 throw new FS.ErrnoError(ERRNO_CODES.EBADF);
3285 if (!FS.isFile(stream.node.mode) && !FS.isDir(node.mode)) {
3286 throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
3289 throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP);
3295 throw new FS.ErrnoError(ERRNO_CODES.EACCES);
3298 throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
3303 throw new FS.ErrnoError(ERRNO_CODES.ENOTTY);
3314 var stream = FS.open(path, opts.flags);
3315 var stat = FS.stat(path);
3318 FS.read(stream, buf, 0, length, 0);
3328 FS.close(stream);
3337 var stream = FS.open(path, opts.flags, opts.mode);
3341 FS.write(stream, buf, 0, buf.length, 0, opts.canOwn);
3343 FS.write(stream, data, 0, data.length, 0, opts.canOwn);
3345 FS.close(stream);
3347 return FS.currentPath;
3349 var lookup = FS.lookupPath(path, { follow: true });
3350 if (!FS.isDir(lookup.node.mode)) {
3351 throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
3353 var err = FS.nodePermissions(lookup.node, 'x');
3355 throw new FS.ErrnoError(err);
3357 FS.currentPath = lookup.path;
3359 FS.mkdir('/tmp');
3362 FS.mkdir('/dev');
3364 FS.registerDevice(FS.makedev(1, 3), {
3368 FS.mkdev('/dev/null', FS.makedev(1, 3));
3372 TTY.register(FS.makedev(5, 0), TTY.default_tty_ops);
3373 TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops);
3374 FS.mkdev('/dev/tty', FS.makedev(5, 0));
3375 FS.mkdev('/dev/tty1', FS.makedev(6, 0));
3378 FS.mkdir('/dev/shm');
3379 FS.mkdir('/dev/shm/tmp');
3382 // input / output callback and that utilizes FS.createDevice
3390 FS.createDevice('/dev', 'stdin', Module['stdin']);
3392 FS.symlink('/dev/tty', '/dev/stdin');
3395 FS.createDevice('/dev', 'stdout', null, Module['stdout']);
3397 FS.symlink('/dev/tty', '/dev/stdout');
3400 FS.createDevice('/dev', 'stderr', null, Module['stderr']);
3402 FS.symlink('/dev/tty1', '/dev/stderr');
3406 var stdin = FS.open('/dev/stdin', 'r');
3407 HEAP32[((_stdin)>>2)]=FS.getPtrForStream(stdin);
3410 var stdout = FS.open('/dev/stdout', 'w');
3411 HEAP32[((_stdout)>>2)]=FS.getPtrForStream(stdout);
3414 var stderr = FS.open('/dev/stderr', 'w');
3415 HEAP32[((_stderr)>>2)]=FS.getPtrForStream(stderr);
3418 if (FS.ErrnoError) return;
3419 FS.ErrnoError = function ErrnoError(errno) {
3429 FS.ErrnoError.prototype = new Error();
3430 FS.ErrnoError.prototype.constructor = FS.ErrnoError;
3433 FS.genericErrors[code] = new FS.ErrnoError(code);
3434 FS.genericErrors[code].stack = '<generic error, no stack>';
3437 FS.ensureErrnoError();
3439 FS.nameTable = new Array(4096);
3441 FS.mount(MEMFS, {}, '/');
3443 FS.createDefaultDirectories();
3444 FS.createDefaultDevices();
3446 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)');
3447 FS.init.initialized = true;
3449 FS.ensureErrnoError();
3456 FS.createStandardStreams();
3458 FS.init.initialized = false;
3459 for (var i = 0; i < FS.streams.length; i++) {
3460 var stream = FS.streams[i];
3464 FS.close(stream);
3480 var ret = FS.analyzePath(path, dontResolveLastLink);
3490 var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
3499 var lookup = FS.lookupPath(path, { parent: true });
3504 lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
3515 var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
3516 var mode = FS.getMode(canRead, canWrite);
3517 return FS.mkdir(path, mode);
3519 parent = typeof parent === 'string' ? parent : FS.getPath(parent);
3526 FS.mkdir(current);
3534 var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
3535 var mode = FS.getMode(canRead, canWrite);
3536 return FS.create(path, mode);
3538 var path = name ? PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name) : parent;
3539 var mode = FS.getMode(canRead, canWrite);
3540 var node = FS.create(path, mode);
3548 FS.chmod(node, mode | 146);
3549 var stream = FS.open(node, 'w');
3550 FS.write(stream, data, 0, data.length, 0, canOwn);
3551 FS.close(stream);
3552 FS.chmod(node, mode);
3556 var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
3557 var mode = FS.getMode(!!input, !!output);
3558 if (!FS.createDevice.major) FS.createDevice.major = 64;
3559 var dev = FS.makedev(FS.createDevice.major++, 0);
3562 FS.registerDevice(dev, {
3579 throw new FS.ErrnoError(ERRNO_CODES.EIO);
3582 throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
3598 throw new FS.ErrnoError(ERRNO_CODES.EIO);
3607 return FS.mkdev(path, mode, dev);
3609 var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
3610 return FS.symlink(target, path);
3725 var node = FS.createFile(parent, name, properties, canRead, canWrite);
3741 if (!FS.forceLoadFile(node)) {
3742 throw new FS.ErrnoError(ERRNO_CODES.EIO);
3749 if (!FS.forceLoadFile(node)) {
3750 throw new FS.ErrnoError(ERRNO_CODES.EIO);
3778 FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn);
3811 var indexedDB = FS.indexedDB();
3813 var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
3820 db.createObjectStore(FS.DB_STORE_NAME);
3824 var transaction = db.transaction([FS.DB_STORE_NAME], 'readwrite');
3825 var files = transaction.objectStore(FS.DB_STORE_NAME);
3831 var putRequest = files.put(FS.analyzePath(path).object.contents, path);
3841 var indexedDB = FS.indexedDB();
3843 var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
3851 var transaction = db.transaction([FS.DB_STORE_NAME], 'readonly');
3856 var files = transaction.objectStore(FS.DB_STORE_NAME);
3864 if (FS.analyzePath(path).exists) {
3865 FS.unlink(path);
3867 FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true);
3882 return FS.createNode(null, '/', 16384 | 511 /* 0777 */, 0);
3903 var node = FS.createNode(SOCKFS.root, name, 49152, 0);
3908 var stream = FS.createStream({
3911 flags: FS.modeStringToFlags('r+'),
3922 var stream = FS.getStream(fd);
3923 if (!stream || !FS.isSocket(stream.node.mode)) {
4020 throw new FS.ErrnoError(ERRNO_CODES.EHOSTUNREACH);
4174 throw new FS.ErrnoError(ERRNO_CODES.EINVAL); // already bound
4192 if (!(e instanceof FS.ErrnoError)) throw e;
4198 throw new FS.ErrnoError(ERRNO_CODS.EOPNOTSUPP);
4210 throw new FS.ErrnoError(ERRNO_CODES.EALREADY);
4212 throw new FS.ErrnoError(ERRNO_CODES.EISCONN);
4224 throw new FS.ErrnoError(ERRNO_CODES.EINPROGRESS);
4227 throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP);
4230 throw new FS.ErrnoError(ERRNO_CODES.EINVAL); // already listening
4266 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
4275 throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
4296 throw new FS.ErrnoError(ERRNO_CODES.EDESTADDRREQ);
4310 throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
4312 throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
4345 throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
4351 throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
4361 throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
4369 throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
4372 throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
4410 var stream = FS.getStream(fildes);
4417 return FS.write(stream, slab, buf, nbyte, offset);
4419 FS
4425 var stream = FS.getStream(fildes);
4434 return FS.write(stream, slab, buf, nbyte);
4436 FS.handleFSError(e);
4444 stream = FS.getStreamFromPtr(stream);
4455 var streamObj = FS.getStreamFromPtr(stream);
4888 var streamObj = FS.getStreamFromPtr(stream);
5629 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;
5632 if (ENVIRONMENT_IS_NODE) { var fs = require("fs"); NODEFS.staticInit(); }
5633 __ATINIT__.push({ func: function() { SOCKFS.root = FS.mount(SOCKFS, {}, null); } });