@grain/stdlib 0.4.0 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/sys/file.gr CHANGED
@@ -529,7 +529,7 @@ export let rec fdRead = (fd: FileDescriptor, size: Number) => {
529
529
  * @param fd: The file descriptor to read from
530
530
  * @param offset: The position within the file to begin reading
531
531
  * @param size: The maximum number of bytes to read from the file descriptor
532
- * @returns `Ok((contents, numBytes)) of bytes read and the number of bytes read if successful or `Err(exception)` otherwise
532
+ * @returns `Ok((contents, numBytes))` of bytes read and the number of bytes read if successful or `Err(exception)` otherwise
533
533
  */
534
534
  export let rec fdPread = (fd: FileDescriptor, offset: Int64, size: Number) => {
535
535
  let fdArg = fd
@@ -635,7 +635,7 @@ export let rec fdPwrite = (fd: FileDescriptor, data: String, offset: Int64) => {
635
635
  let mut nwritten = iovs + (3n * 4n)
636
636
 
637
637
  let err = Wasi.fd_pwrite(fd, iovs, 1n, offset, nwritten)
638
- if (err != Wasi._ESUCCESS) {
638
+ let ret = if (err != Wasi._ESUCCESS) {
639
639
  Memory.free(iovs)
640
640
  wasmSafeErr(Wasi.SystemError(tagSimpleNumber(err)))
641
641
  } else {
@@ -649,6 +649,7 @@ export let rec fdPwrite = (fd: FileDescriptor, data: String, offset: Int64) => {
649
649
  Memory.decRef(WasmI32.fromGrain(data))
650
650
  Memory.decRef(WasmI32.fromGrain(offsetArg))
651
651
  Memory.decRef(WasmI32.fromGrain(fdPwrite))
652
+ ret
652
653
  }
653
654
 
654
655
  /**
package/sys/file.md CHANGED
@@ -277,7 +277,7 @@ Returns:
277
277
 
278
278
  |type|description|
279
279
  |----|-----------|
280
- |`Result<(String, Number), Exception>`|`Ok((contents, numBytes)) of bytes read and the number of bytes read if successful or `Err(exception)` otherwise|
280
+ |`Result<(String, Number), Exception>`|`Ok((contents, numBytes))` of bytes read and the number of bytes read if successful or `Err(exception)` otherwise|
281
281
 
282
282
  ### File.**fdWrite**
283
283
 
@@ -904,7 +904,7 @@ Returns:
904
904
 
905
905
  |type|description|
906
906
  |----|-----------|
907
- |`Result<(String, Number), Exception>`|`Ok((contents, nBytes))` of the bytes read and the number of bytes read if successful or `Err(exception)` otherwise|
907
+ |`Result<(String, Number), Exception>`|`Ok((contents, numBytes))` of the bytes read and the number of bytes read if successful or `Err(exception)` otherwise|
908
908
 
909
909
  ### File.**pathRemoveDirectory**
910
910