diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-04-28 12:30:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-28 12:30:59 +0200 |
commit | dea3ca39ba6c4eedd397af700f3754a8fc10ec23 (patch) | |
tree | 76d85d9b216e1159679845af686c60c79045c27d /cli/js/lib.deno.ns.d.ts | |
parent | 30dc9bb748f7885a8fd7fe1210e18bf45ee063b8 (diff) |
refactor: rename SeekMode variants to camelCase and stabilize (#4946)
Diffstat (limited to 'cli/js/lib.deno.ns.d.ts')
-rw-r--r-- | cli/js/lib.deno.ns.d.ts | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts index 3c568f798..534c5707d 100644 --- a/cli/js/lib.deno.ns.d.ts +++ b/cli/js/lib.deno.ns.d.ts @@ -383,11 +383,10 @@ declare namespace Deno { export const EOF: unique symbol; export type EOF = typeof EOF; - /** **UNSTABLE**: might remove `"SEEK_"` prefix. Might not use all-caps. */ export enum SeekMode { - SEEK_START = 0, - SEEK_CURRENT = 1, - SEEK_END = 2, + Start = 0, + Current = 1, + End = 2, } export interface Reader { @@ -470,9 +469,9 @@ declare namespace Deno { export interface Seeker { /** Seek sets the offset for the next `read()` or `write()` to offset, - * interpreted according to `whence`: `SEEK_START` means relative to the - * start of the file, `SEEK_CURRENT` means relative to the current offset, - * and `SEEK_END` means relative to the end. Seek resolves to the new offset + * interpreted according to `whence`: `Start` means relative to the + * start of the file, `Current` means relative to the current offset, + * and `End` means relative to the end. Seek resolves to the new offset * relative to the start of the file. * * Seeking to an offset before the start of the file is an error. Seeking to @@ -485,9 +484,9 @@ declare namespace Deno { export interface SyncSeeker { /** Seek sets the offset for the next `readSync()` or `writeSync()` to - * offset, interpreted according to `whence`: `SEEK_START` means relative - * to the start of the file, `SEEK_CURRENT` means relative to the current - * offset, and `SEEK_END` means relative to the end. + * offset, interpreted according to `whence`: `Start` means relative + * to the start of the file, `Current` means relative to the current + * offset, and `End` means relative to the end. * * Seeking to an offset before the start of the file is an error. Seeking to * any positive offset is legal, but the behavior of subsequent I/O @@ -695,7 +694,7 @@ declare namespace Deno { * const file = Deno.openSync('hello.txt', {read: true, write: true, truncate: true, create: true}); * Deno.writeSync(file.rid, new TextEncoder().encode("Hello world")); * // advance cursor 6 bytes - * const cursorPosition = Deno.seekSync(file.rid, 6, Deno.SeekMode.SEEK_START); + * const cursorPosition = Deno.seekSync(file.rid, 6, Deno.SeekMode.Start); * console.log(cursorPosition); // 6 * const buf = new Uint8Array(100); * file.readSync(buf); @@ -705,11 +704,11 @@ declare namespace Deno { * * // Given file.rid pointing to file with "Hello world", which is 11 bytes long: * // Seek 6 bytes from the start of the file - * console.log(Deno.seekSync(file.rid, 6, Deno.SeekMode.SEEK_START)); // "6" + * console.log(Deno.seekSync(file.rid, 6, Deno.SeekMode.Start)); // "6" * // Seek 2 more bytes from the current position - * console.log(Deno.seekSync(file.rid, 2, Deno.SeekMode.SEEK_CURRENT)); // "8" + * console.log(Deno.seekSync(file.rid, 2, Deno.SeekMode.Current)); // "8" * // Seek backwards 2 bytes from the end of the file - * console.log(Deno.seekSync(file.rid, -2, Deno.SeekMode.SEEK_END)); // "9" (e.g. 11-2) + * console.log(Deno.seekSync(file.rid, -2, Deno.SeekMode.End)); // "9" (e.g. 11-2) */ export function seekSync( rid: number, @@ -723,7 +722,7 @@ declare namespace Deno { * const file = await Deno.open('hello.txt', {read: true, write: true, truncate: true, create: true}); * await Deno.write(file.rid, new TextEncoder().encode("Hello world")); * // advance cursor 6 bytes - * const cursorPosition = await Deno.seek(file.rid, 6, Deno.SeekMode.SEEK_START); + * const cursorPosition = await Deno.seek(file.rid, 6, Deno.SeekMode.Start); * console.log(cursorPosition); // 6 * const buf = new Uint8Array(100); * await file.read(buf); @@ -733,11 +732,11 @@ declare namespace Deno { * * // Given file.rid pointing to file with "Hello world", which is 11 bytes long: * // Seek 6 bytes from the start of the file - * console.log(await Deno.seek(file.rid, 6, Deno.SeekMode.SEEK_START)); // "6" + * console.log(await Deno.seek(file.rid, 6, Deno.SeekMode.Start)); // "6" * // Seek 2 more bytes from the current position - * console.log(await Deno.seek(file.rid, 2, Deno.SeekMode.SEEK_CURRENT)); // "8" + * console.log(await Deno.seek(file.rid, 2, Deno.SeekMode.Current)); // "8" * // Seek backwards 2 bytes from the end of the file - * console.log(await Deno.seek(file.rid, -2, Deno.SeekMode.SEEK_END)); // "9" (e.g. 11-2) + * console.log(await Deno.seek(file.rid, -2, Deno.SeekMode.End)); // "9" (e.g. 11-2) */ export function seek( rid: number, |