title |
---|
Fs |
Type declarations included in the Fs module.
enum FileError {
PermissionDenied,
AddressInUse,
AddressNotAvailable,
AddressFamilyNotSupported,
ResourceUnavailableOrOperationWouldBlock,
ConnectionAlreadyInProgress,
BadFileDescriptor,
BadMessage,
DeviceOrResourceBusy,
OperationCanceled,
NoChildProcesses,
ConnectionAborted,
ConnectionRefused,
ConnectionReset,
ResourceDeadlockWouldOccur,
DestinationAddressRequired,
MathematicsArgumentOutOfDomainOfFunction,
FileExists,
BadAddress,
FileTooLarge,
HostIsUnreachable,
IdentifierRemoved,
IllegalByteSequence,
OperationInProgress,
InterruptedFunction,
InvalidArgument,
IOError,
SocketIsConnected,
IsADirectory,
TooManyLevelsOfSymbolicLinks,
FileDescriptorValueTooLarge,
TooManyLinks,
MessageTooLarge,
FilenameTooLong,
NetworkIsDown,
ConnectionAbortedByNetwork,
NetworkUnreachable,
TooManyFilesOpenInSystem,
NoBufferSpaceAvailable,
NoSuchDevice,
NoSuchFileOrDirectory,
ExecutableFileFormatError,
NoLocksAvailable,
NotEnoughSpace,
NoMessageOfTheDesiredType,
ProtocolNotAvailable,
NoSpaceLeftOnDevice,
FunctionNotSupported,
TheSocketIsNotConnected,
NotADirectoryOrASymbolicLinkToADirectory,
DirectoryNotEmpty,
StateNotRecoverable,
NotASocket,
NotSupportedOrOperationNotSupportedOnSocket,
InappropriateIOControlOperation,
NoSuchDeviceOrAddress,
ValueTooLargeToBeStoredInDataType,
PreviousOwnerDied,
OperationNotPermitted,
BrokenPipe,
ProtocolError,
ProtocolNotSupported,
ProtocolWrongTypeForSocket,
ResultTooLarge,
ReadOnlyFileSystem,
InvalidSeek,
NoSuchProcess,
ConnectionTimedOut,
TextFileBusy,
CrossDeviceLink,
ExtensionCapabilitiesInsufficient,
}
Potential errors that can be raised from WASI system interactions. Note that not all of these variants may actually be possible to encounter from this API but were nevertheless included for full compatibility with WASI error codes
Functions and constants included in the Fs module.
Added in next
No other changes yet.
readFile : (path: Path.Path) => Result<Bytes, FileError>
Read the contents of a file.
Parameters:
param | type | description |
---|---|---|
path |
Path.Path |
The file path to read from |
Returns:
type | description |
---|---|
Result<Bytes, FileError> |
Ok(contents) containing the bytes read if successful or Err(err) otherwise |
Added in next
No other changes yet.
writeFile : (path: Path.Path, data: Bytes) => Result<Number, FileError>
Write contents to a file.
Parameters:
param | type | description |
---|---|---|
path |
Path.Path |
The file path to write to |
data |
Bytes |
The bytes to write to the file |
Returns:
type | description |
---|---|
Result<Number, FileError> |
Ok(numBytes) containing the number of bytes written if successful or Err(err) otherwise |
appendFile : (path: Path.Path, data: Bytes) => Result<Number, FileError>
Functions and constants included in the Fs.Utf8 module.
readFile : (path: Path.Path) => Result<String, FileError>
writeFile : (path: Path.Path, data: String) => Result<Number, FileError>
appendFile : (path: Path.Path, data: String) => Result<Number, FileError>