FileAPI
Types
blob
A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system.See Blob on MDN
typeblob= {size:int,type_:string}Record fields
Module
There are methods and helpers defined in Blob.
blobPart
@unboxedtypeblobPart=String(string) |Blob(blob)blobPropertyBag
typeblobPropertyBag= {mutabletype_?:string,mutableendings?:endingType,}Record fields
type_
endings
endingType
typeendingType=| @as("native")Native| @as("transparent")Transparentfile
Provides information about files and allows JavaScript in a web page to access their content.See File on MDN
typefile= {size:int,type_:string,name:string,lastModified:int,webkitRelativePath:string,}Record fields
Module
There are methods and helpers defined in File.
filePropertyBag
typefilePropertyBag= {mutabletype_?:string,mutableendings?:endingType,mutablelastModified?:int,}Record fields
type_
endings
lastModified
fileSystemCreateWritableOptions
typefileSystemCreateWritableOptions= {mutablekeepExistingData?:bool,}Record fields
keepExistingData
fileSystemDirectoryHandle
typefileSystemDirectoryHandle= {kind:fileSystemHandleKind,name:string,}Record fields
Module
There are methods and helpers defined in FileSystemDirectoryHandle.
fileSystemFileHandle
typefileSystemFileHandle= {kind:fileSystemHandleKind,name:string,}Record fields
Module
There are methods and helpers defined in FileSystemFileHandle.
fileSystemGetDirectoryOptions
typefileSystemGetDirectoryOptions= {mutablecreate?:bool}Record fields
create
fileSystemGetFileOptions
typefileSystemGetFileOptions= {mutablecreate?:bool}Record fields
create
fileSystemHandle
typefileSystemHandle= {kind:fileSystemHandleKind,name:string,}Record fields
Module
There are methods and helpers defined in FileSystemHandle.
fileSystemHandleKind
typefileSystemHandleKind=| @as("directory")Directory| @as("file")FilefileSystemRemoveOptions
typefileSystemRemoveOptions= {mutablerecursive?:bool}Record fields
recursive
fileSystemWritableFileStream
typefileSystemWritableFileStream= {locked:bool}Record fields
Module
There are methods and helpers defined in FileSystemWritableFileStream.
fileSystemWriteChunkType
typefileSystemWriteChunkType=WebAPI.Prelude.anyqueuingStrategy
typequeuingStrategy<'t>=WebAPI.Prelude.anyreadableStream
This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.See ReadableStream on MDN
typereadableStream<'r>= {locked:bool}Record fields
Module
There are methods and helpers defined in ReadableStream.
readableStreamGetReaderOptions
typereadableStreamGetReaderOptions= {mutablemode?:readableStreamReaderMode,}Record fields
mode
Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.
readableStreamReader
typereadableStreamReader<'t>=WebAPI.Prelude.anyreadableStreamReaderMode
typereadableStreamReaderMode= @as("byob")ByobreadableWritablePair
typereadableWritablePair<'r,'w>= {mutablereadable:readableStream<'r>,mutablewritable:writableStream<'w>,}Record fields
readable
writable
Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
streamPipeOptions
typestreamPipeOptions= {mutablepreventClose?:bool,mutablepreventAbort?:bool,mutablepreventCancel?:bool,mutablesignal?:WebAPI.EventAPI.abortSignal,}Record fields
preventClose
Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
Errors and closures of the source and destination streams propagate as follows:
An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.
An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.
When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.
If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.
The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
preventAbort
preventCancel
signal
underlyingByteSource
typeunderlyingByteSource= {mutabletype_:unknown,mutableautoAllocateChunkSize?:int,mutablestart?:unknown,mutablepull?:unknown,mutablecancel?:underlyingSourceCancelCallback,}Record fields
type_
autoAllocateChunkSize
start
pull
cancel
underlyingSink
typeunderlyingSink<'t>=WebAPI.Prelude.anyunderlyingSourceCancelCallback
typeunderlyingSourceCancelCallback=JSON.t=>promise<unit,>writableStream
This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.See WritableStream on MDN
typewritableStream<'w>= {locked:bool}Record fields
Module
There are methods and helpers defined in WritableStream.
writableStreamDefaultController
This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.See WritableStreamDefaultController on MDN
typewritableStreamDefaultController= {signal:WebAPI.EventAPI.abortSignal,}Record fields
Module
There are methods and helpers defined in WritableStreamDefaultController.
writableStreamDefaultWriter
typewritableStreamDefaultWriter<'t>=WebAPI.Prelude.anywriteCommandType
typewriteCommandType=| @as("seek")Seek| @as("truncate")Truncate| @as("write")WritewriteParams
typewriteParams= {mutabletype_:writeCommandType,mutablesize?:Null.t<int>,mutableposition?:Null.t<int>,mutabledata?:Null.t<unknown>,}