🔍Search
search(search: string, {
version?: string,
category?: string,
skip?: boolean
}): Promise<docsParsed | Error>
Code example:
Import the package
const { nodejs } = require('search-docs');
search
readFileSync
in fs
nodejs.search('readFileSync', { category: "fs" })
OR
nodejs.search('fs#readFileSync')
You can also specify a version of Node.js (default: latest)
nodejs.search('readFileSync', { category: "fs", version: "v18.x" })
A cache system is implemented in the module, in order to skip this cache system and directly make a request for get result in real time please add the skip option
nodejs.search('readFileSync', { category: "fs", skip: true })
For readSync
here are the types that the function return as well as a concrete example of what it returns:
readSync
here are the types that the function return as well as a concrete example of what it returns:markdown: string;
sourceCode: string | undefined;
name: { short: string, long: string };
introducedIn: string;
stability: { text: string, number: number };
description: string;
methods: Array<{
function: string,
name: string,
description: string,
sourceLink: string | null,
params: Array<{
textRaw: string,
name: string,
type: string,
desc: string | undefined,
options: Array<{
textRaw: string,
name: string,
type: string,
default: string | undefined,
desc: string | undefined
}> | undefined
}> | undefined,
return: {
textRaw: string,
name: string,
type: string
} | undefined,
meta: {
addedVersion: string | null,
deprecatedVersion: string | null,
changesVersion: Array<{
version: string | Array<string>,
"pr-url": string,
description: string
}> | undefined
},
stability: {
text: string | null,
number: number | null
}
}>;
Concret exemple with readSync
:
readSync
:{
markdown: 'https://github.com/nodejs/node/blob/main/doc/api/fs.md',
sourceCode: 'https://github.com/nodejs/node/blob/v16.16.0/lib/fs.js',
name: { short: 'fs', long: 'File system' },
introducedIn: 'v0.10.0',
stability: { text: 'Stable', number: 2 },
description: '**Source Code:** [lib/fs.js](https://github.com/nodejs/node/blob/v16.16.0/lib/fs.js)\n' +
'\n' +
'The `fs` module enables interacting with the file system in a way modeled on standard POSIX functions.\n' +
'\n' +
'To use the promise-based APIs:\n' +
'\n' +
'```js\n' +
"import * as fs from 'fs/promises';\n" +
'```\n' +
'```js\n' +
"const fs = require('fs/promises');\n" +
'```\n' +
'\n' +
'To use the callback and sync APIs:\n' +
'\n' +
'```js\n' +
"import * as fs from 'fs';\n" +
'```\n' +
'```js\n' +
"const fs = require('fs');\n" +
'```\n' +
'\n' +
'All file system operations have synchronous, callback, and promise-based forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM).',
methods: [
{
function: 'dir.readSync()',
name: 'readSync',
description: 'Synchronously read the next directory entry as an [<fs.Dirent>](fs.html#class-fsdirent). See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more detail.\n' +
'\n' +
'If there are no more directory entries to read, `null` will be returned.\n' +
'\n' +
"Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms. Entries added or removed while iterating over the directory might not be included in the iteration results.",
sourceLink: null,
params: [],
return: [Object],
meta: [Object],
stability: [Object]
},
{
function: 'fs.readSync(fd, buffer[, options])',
name: 'readSync',
description: 'Returns the number of `bytesRead`.\n' +
'\n' +
'Similar to the above `fs.readSync` function, this version takes an optional `options` object. If no `options` object is specified, it will default with the above values.\n' +
'\n' +
'For detailed information, see the documentation of the asynchronous version of this API: [`fs.read()`](fs.html#fsreadfd-buffer-offset-length-position-callback).',
sourceLink: 'https://github.com/nodejs/node/blob/c98901f00d4b31a9a4b14d161177a7d9a64e36f7/lib/fs.js#L684',
params: [Array],
return: [Object],
meta: [Object],
stability: [Object]
},
{
function: 'fs.readSync(fd, buffer, offset, length, position)',
name: 'readSync',
description: 'Returns the number of `bytesRead`.\n' +
'\n' +
'For detailed information, see the documentation of the asynchronous version of this API: [`fs.read()`](fs.html#fsreadfd-buffer-offset-length-position-callback).',
sourceLink: 'https://github.com/nodejs/node/blob/c98901f00d4b31a9a4b14d161177a7d9a64e36f7/lib/fs.js#L684',
params: [Array],
return: [Object],
meta: [Object],
stability: [Object]
}
]
}
Last updated