summaryrefslogtreecommitdiff
path: root/cli/js/lib.deno.ns.d.ts
diff options
context:
space:
mode:
authorChris Knight <cknight1234@gmail.com>2020-05-22 17:56:12 +0100
committerGitHub <noreply@github.com>2020-05-22 12:56:12 -0400
commit4b06e357655e5e4e1aba6d9591eeb7ca269850ed (patch)
tree2349203dec447dc6e08fa5d8aa2c9d6c2dc85403 /cli/js/lib.deno.ns.d.ts
parentf9e45114b9c423b72e9c44c4a8aef90f5c3b44d6 (diff)
doc: clarify and warn on Deno.read/write behaviour (#5743)
Diffstat (limited to 'cli/js/lib.deno.ns.d.ts')
-rw-r--r--cli/js/lib.deno.ns.d.ts24
1 files changed, 22 insertions, 2 deletions
diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts
index f5e9c0fe7..d2a18c414 100644
--- a/cli/js/lib.deno.ns.d.ts
+++ b/cli/js/lib.deno.ns.d.ts
@@ -456,6 +456,11 @@ declare namespace Deno {
* It is possible for a read to successfully return with `0` bytes. This does
* not indicate EOF.
*
+ * This function is one of the lowest level APIs and most users should not
+ * work with this directly, but rather use Deno.readAllSync() instead.
+ *
+ * **It is not guaranteed that the full buffer will be read in a single call.**
+ *
* ```ts
* // if "/foo/bar.txt" contains the text "hello world":
* const file = Deno.openSync("/foo/bar.txt");
@@ -475,6 +480,11 @@ declare namespace Deno {
* It is possible for a read to successfully return with `0` bytes. This does
* not indicate EOF.
*
+ * This function is one of the lowest level APIs and most users should not
+ * work with this directly, but rather use Deno.readAll() instead.
+ *
+ * **It is not guaranteed that the full buffer will be read in a single call.**
+ *
* ```ts
* // if "/foo/bar.txt" contains the text "hello world":
* const file = await Deno.open("/foo/bar.txt");
@@ -489,7 +499,12 @@ declare namespace Deno {
/** Synchronously write to the resource ID (`rid`) the contents of the array
* buffer (`data`).
*
- * Returns the number of bytes written.
+ * Returns the number of bytes written. This function is one of the lowest
+ * level APIs and most users should not work with this directly, but rather use
+ * Deno.writeAllSync() instead.
+ *
+ * **It is not guaranteed that the full buffer will be written in a single
+ * call.**
*
* ```ts
* const encoder = new TextEncoder();
@@ -503,7 +518,12 @@ declare namespace Deno {
/** Write to the resource ID (`rid`) the contents of the array buffer (`data`).
*
- * Resolves to the number of bytes written.
+ * Resolves to the number of bytes written. This function is one of the lowest
+ * level APIs and most users should not work with this directly, but rather use
+ * Deno.writeAll() instead.
+ *
+ * **It is not guaranteed that the full buffer will be written in a single
+ * call.**
*
* ```ts
* const encoder = new TextEncoder();