diff --git a/api/README.md b/api/README.md index 0932c5b26c..5318814786 100644 --- a/api/README.md +++ b/api/README.md @@ -868,7 +868,7 @@ Chages ownership of link at `path` with `uid` and `gid. ## [`link(src, dest, )`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L368) -Creates a link to `dest` from `dest`. +Creates a link to `dest` from `src`. | Argument | Type | Default | Optional | Description | | :--- | :--- | :---: | :---: | :--- | diff --git a/api/fs/dir.js b/api/fs/dir.js index f1193ee14e..551dc1674a 100644 --- a/api/fs/dir.js +++ b/api/fs/dir.js @@ -70,12 +70,12 @@ export class Dir { } /** - * `true` if closeing, otherwise `false`. + * `true` if closing, otherwise `false`. * @ignore * @type {boolean} */ get closing () { - return Boolean(this.handle?.closig) + return Boolean(this.handle?.closing) } /** diff --git a/api/fs/index.js b/api/fs/index.js index 1b13910118..8f7dab12e2 100644 --- a/api/fs/index.js +++ b/api/fs/index.js @@ -360,7 +360,7 @@ export function lchown (path, uid, gid, callback) { } /** - * Creates a link to `dest` from `dest`. + * Creates a link to `dest` from `src`. * @param {string} src * @param {string} dest * @param {function} diff --git a/api/fs/watcher.js b/api/fs/watcher.js index 120d675083..502e71baf4 100644 --- a/api/fs/watcher.js +++ b/api/fs/watcher.js @@ -1,4 +1,5 @@ import { EventEmitter } from '../events.js' +import { FileHandle } from './handle.js' import { AbortError } from '../errors.js' import { rand64 } from '../crypto.js' import { Buffer } from '../buffer.js' @@ -32,6 +33,13 @@ function encodeFilename (watcher, filename) { * @return {Promise} */ async function start (watcher) { + // throws if not accessible + await FileHandle.access(watcher.path) + + if (!watcher.id || typeof watcher.id !== 'string') { + throw new TypeError('Expectig fs.Watcher to have a id.') + } + const result = await ipc.send('fs.watch', { path: watcher.path, id: watcher.id diff --git a/api/index.d.ts b/api/index.d.ts index 3b2ef83396..2a2a197833 100644 --- a/api/index.d.ts +++ b/api/index.d.ts @@ -2286,7 +2286,7 @@ declare module "socket:fs/dir" { */ get closed(): boolean; /** - * `true` if closeing, otherwise `false`. + * `true` if closing, otherwise `false`. * @ignore * @type {boolean} */ @@ -2955,7 +2955,7 @@ declare module "socket:fs/index" { */ export function lchown(path: string, uid: number, gid: number, callback: Function): void; /** - * Creates a link to `dest` from `dest`. + * Creates a link to `dest` from `src`. * @param {string} src * @param {string} dest * @param {function}