MCPcopy Create free account
hub / github.com/diffusionstudio/vits-web / createStream

Function createStream

src/piper.js:2144–2199  ·  view source on GitHub ↗
(stream, fd = -1)

Source from the content-addressed store, hash-verified

2142 },
2143 getStream: (fd) => FS.streams[fd],
2144 createStream(stream, fd = -1) {
2145 if (!FS.FSStream) {
2146 FS.FSStream = function () {
2147 this.shared = {};
2148 };
2149 FS.FSStream.prototype = {};
2150 Object.defineProperties(FS.FSStream.prototype, {
2151 object: {
2152 get() {
2153 return this.node;
2154 },
2155 set(val) {
2156 this.node = val;
2157 },
2158 },
2159 isRead: {
2160 get() {
2161 return (this.flags & 2097155) !== 1;
2162 },
2163 },
2164 isWrite: {
2165 get() {
2166 return (this.flags & 2097155) !== 0;
2167 },
2168 },
2169 isAppend: {
2170 get() {
2171 return this.flags & 1024;
2172 },
2173 },
2174 flags: {
2175 get() {
2176 return this.shared.flags;
2177 },
2178 set(val) {
2179 this.shared.flags = val;
2180 },
2181 },
2182 position: {
2183 get() {
2184 return this.shared.position;
2185 },
2186 set(val) {
2187 this.shared.position = val;
2188 },
2189 },
2190 });
2191 }
2192 stream = Object.assign(new FS.FSStream(), stream);
2193 if (fd == -1) {
2194 fd = FS.nextfd();
2195 }
2196 stream.fd = fd;
2197 FS.streams[fd] = stream;
2198 return stream;
2199 },
2200 closeStream(fd) {
2201 FS.streams[fd] = null;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected