one
Version:
One is a React framework for web, iOS, and Android apps.
1 lines • 2.53 kB
Source Map (JSON)
{"version":3,"file":"streams.js","names":[],"sources":["esm/platform/file-system/streams.js"],"sourcesContent":["class FileSystemReadableStreamSource {\n handle;\n size = 1024;\n type = \"bytes\";\n constructor(handle) {\n this.handle = handle;\n }\n cancel() {\n this.handle.close();\n }\n async pull(controller) {\n const view = controller.byobRequest?.view;\n let bytes;\n try {\n bytes = await this.handle.readBytes(view ? view.byteLength : this.size);\n } catch (error) {\n try {\n this.handle.close();\n } catch {\n }\n throw error;\n }\n if (!view) {\n if (bytes.length === 0) {\n this.handle.close();\n controller.close();\n return;\n }\n controller.enqueue(bytes);\n return;\n }\n if (bytes.length === 0) {\n this.handle.close();\n controller.close();\n controller.byobRequest?.respond(0);\n return;\n }\n new Uint8Array(view.buffer, view.byteOffset, view.byteLength).set(bytes);\n controller.byobRequest?.respond(bytes.length);\n }\n}\nclass FileSystemWritableSink {\n handle;\n constructor(handle) {\n this.handle = handle;\n }\n abort() {\n this.close();\n }\n close() {\n this.handle.close();\n }\n async write(chunk) {\n try {\n await this.handle.writeBytes(chunk);\n } catch (error) {\n try {\n this.handle.close();\n } catch {\n }\n throw error;\n }\n }\n}\nexport {\n FileSystemReadableStreamSource,\n FileSystemWritableSink\n};\n//# sourceMappingURL=streams.js.map\n"],"mappings":";AAAA,IAAM,iCAAN,MAAqC;CACnC;CACA,OAAO;CACP,OAAO;CACP,YAAY,QAAQ;EAClB,KAAK,SAAS;CAChB;CACA,SAAS;EACP,KAAK,OAAO,MAAM;CACpB;CACA,MAAM,KAAK,YAAY;EACrB,MAAM,OAAO,WAAW,aAAa;EACrC,IAAI;EACJ,IAAI;GACF,QAAQ,MAAM,KAAK,OAAO,UAAU,OAAO,KAAK,aAAa,KAAK,IAAI;EACxE,SAAS,OAAO;GACd,IAAI;IACF,KAAK,OAAO,MAAM;GACpB,QAAQ,CACR;GACA,MAAM;EACR;EACA,IAAI,CAAC,MAAM;GACT,IAAI,MAAM,WAAW,GAAG;IACtB,KAAK,OAAO,MAAM;IAClB,WAAW,MAAM;IACjB;GACF;GACA,WAAW,QAAQ,KAAK;GACxB;EACF;EACA,IAAI,MAAM,WAAW,GAAG;GACtB,KAAK,OAAO,MAAM;GAClB,WAAW,MAAM;GACjB,WAAW,aAAa,QAAQ,CAAC;GACjC;EACF;EACA,IAAI,WAAW,KAAK,QAAQ,KAAK,YAAY,KAAK,UAAU,CAAC,CAAC,IAAI,KAAK;EACvE,WAAW,aAAa,QAAQ,MAAM,MAAM;CAC9C;AACF;AACA,IAAM,yBAAN,MAA6B;CAC3B;CACA,YAAY,QAAQ;EAClB,KAAK,SAAS;CAChB;CACA,QAAQ;EACN,KAAK,MAAM;CACb;CACA,QAAQ;EACN,KAAK,OAAO,MAAM;CACpB;CACA,MAAM,MAAM,OAAO;EACjB,IAAI;GACF,MAAM,KAAK,OAAO,WAAW,KAAK;EACpC,SAAS,OAAO;GACd,IAAI;IACF,KAAK,OAAO,MAAM;GACpB,QAAQ,CACR;GACA,MAAM;EACR;CACF;AACF"}