
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
nexusdocs-client
Advanced tools
Client-SDK for nexusdocs-server
npm install nexusdocs-client
Class presenting NexusDocs client instance
Class presenting NexusDocs namespace instance
Client ⏏Create a NexusDocs client instance
Kind: Exported function
See: new Client()
| Param | Type | Description |
|---|---|---|
| options | ServerOptions | Server options, see ServerOptions |
Example
Create a client
const createClient = require('nexusdocs-client');
// Object style server options:
const client = createClient({
hostname: '192.168.1.6',
port: 4001,
apiKey: 'MY_API_KEY',
apiSecret: 'MY_API_SECRET',
});
// URL style server options:
const client = createClient('http://MY_API_KEY:MY_API_SECRET@192.168.1.6:4001/api');
Class presenting NexusDocs client instance
Kind: global class
objectCreates an instance of NDS Client.
| Param | Type | Description |
|---|---|---|
| options | ServerOptions | string | Server options, see ServerOptions |
Example
You can pass a URL sting instead of a config object:
http://<clientKey>:<clientSecret>@<hostname>:<port><endPoint>
NamespaceGet namespace instance
Kind: instance method of Client
Returns: Namespace - Namespace instance
| Param | Type | Description |
|---|---|---|
| name | string | The name |
| [options] | object | Additional options |
objectServer options
Kind: inner typedef of Client
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| clientKey | string | NDS API key | |
| clientSecret | string | NDS API secret | |
| [hostname] | string | "127.0.0.1" | hostname |
| [secure] | boolean | false | Whether to use HTTPS |
| [port] | number | 4000 | Server Port |
| [endPoint] | string | "/api" | API endpoint |
| [defaultUrlExpires] | number | Default expires seconds | |
| [defaultRequestExpires] | number | Default expires seconds |
Class presenting NexusDocs namespace instance
Kind: global class
stringstringstringPromiseWritableStreamPromiseReadableStreamPromisePromisePromisePromisePromiseobjectobjectobjectstringobjectobjectobjectobjectobjectNamespace Class constructor
| Param | Type | Description |
|---|---|---|
| client | Client | NDS Client instance |
| name | string | The name of namespace |
| options | object |
Example
Create a namespace instance
const namespace = client.getNamespace('a.name.space');
stringGet URL for upload
Kind: instance method of Namespace
Returns: string - URL for upload
| Param | Type | Description |
|---|---|---|
| [options] | RequestOptions | Additional options, see RequestOptions |
| [options.resumable] | boolean | If upload with resumbable.js |
| [options.expires] | date | Timestamp the Request will available before |
stringGet file URL for view or download
Kind: instance method of Namespace
Returns: string - file URL
| Param | Type | Description |
|---|---|---|
| fileId | FileId | File identifier, see FileId |
| [options] | DownloadOptions | Additional options, see DownloadOptions |
stringGet the converted file URL for view or download
Kind: instance method of Namespace
Returns: string - The converted file URL
| Param | Type | Description |
|---|---|---|
| fileId | FileId | File identifier, see FileId |
| converting | ConvertingOptions | Converting options, see ConvertingOptions |
| [options] | DownloadOptions | Additional options, see DownloadOptions |
PromiseUpload file from Buffer, ReadableStream
Kind: instance method of Namespace
Fulfil: object File info when uploading is finished
Reject: any Request error
| Param | Type | Description |
|---|---|---|
| Buffer | ReadableStream | data |
| [options] | UploadOptions | Additional options, see UploadOptions |
WritableStreamGet upload stream
Kind: instance method of Namespace
Returns: WritableStream - Writable stream for upload
| Param | Type | Description |
|---|---|---|
| [options] | UploadOptions | Additional options, see UploadOptions |
| [options.stream] | ReadableStream | Provide readable stream directly |
PromiseUpload a file from local file-system
Kind: instance method of Namespace
Fulfil: FileInfo File info when uploading is finished
Reject: any Request error
| Param | Type | Description |
|---|---|---|
| filePath | string | The path of file will be uploaded |
| options | UploadOptions | Upload options |
ReadableStreamGet a readable stream for download
Kind: instance method of Namespace
Returns: ReadableStream - - the readable stream
| Param | Type | Description |
|---|---|---|
| fileId | FileId | The file needed to download later, see FileId |
| [options] | RequestOptions | Additional options, see RequestOptions |
PromiseDownload a file to local file-system
Kind: instance method of Namespace
Fulfil: any Download finished
| Param | Type | Description |
|---|---|---|
| fileId | FileId | The file id, see FileId |
| filePath | string | The path of file will be saved |
| [options] | RequestOptions | Additional options, see RequestOptions |
PromiseGet file information
Kind: instance method of Namespace
Fulfil: FileInfo file information
| Param | Type |
|---|---|
| fileId | FileId |
PromiseDelete a file on the server
Kind: instance method of Namespace
Fulfil: object When deletion is finished
Reject: any When a error occur
| Param | Type | Description |
|---|---|---|
| fileId | FileId | The file to be deleted, see FileId |
PromiseDelete all files in this namespace
Kind: instance method of Namespace
PromiseCreate an archive
Kind: instance method of Namespace
| Param | Type | Description |
|---|---|---|
| files | Array.<FileId> | file id array |
Archive files then return download URL
Kind: instance method of Namespace
| Param | Type | Description |
|---|---|---|
| files | Array.<FileId> | file id array, see FileId |
| options | RequestOptions | RequestOptions, see RequestOptions |
objectRequest options for request, some properties are added for additional use, see specified method
Kind: inner typedef of Namespace
Properties
| Name | Type | Description |
|---|---|---|
| method | string | HTTP method of the request |
| url | string | Path of the request, or full url |
| [body] | string | Entire body for PATCH, PUT, POST or DELETE, json must be true and only plain object is allowed |
| [json] | boolean | Set to true when providing body |
| [expires] | number | date | Expires time in second, timestamp or Date object, the request will be invalid after this timestamp |
| [signature] | object | Additional signature data besides method, url, expires |
objectUpload request options
Kind: inner typedef of Namespace
Extends: RequestOptions
Properties
| Name | Type | Description |
|---|---|---|
| [fileId] | FileId | Specify fileId, see FileId |
| [filename] | string | Provide filename |
| [md5] | string | MD5 hash of the file if available |
| [contentType] | string | Provide content-type for download |
| [knownLength] | number | Provide stream total length if available |
objectDownload options
Kind: inner typedef of Namespace
Extends: RequestOptions
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| [origin] | boolean | false | Download from the origin provider |
| [download] | boolean | false | Download with the original filename |
| [filename] | string | Download with new filename, this will set contentType & contentDisposition | |
| [response] | object | Overwrite response header | |
| [response.contentType] | string | Overwrite Content-Type | |
| [response.contentDisposition] | string | Overwrite Content-Disposition |
stringFile identifier
Kind: inner typedef of Namespace
Example
Example file id: `e5ac71cf-a0f0-46b5-9070-268ae97bb769`
objectImage file info
Kind: inner typedef of Namespace
Properties
| Name | Type | Description |
|---|---|---|
| width | number | Image width |
| height | number | Image height |
| type | number | Image type, e.g. jpeg, png, gif |
| thumbnailUrl | string | Image thumbnail data-url |
objectZip file entry
Kind: inner typedef of Namespace
Properties
| Name | Type | Description |
|---|---|---|
| path | string | Relative path to zip archive |
| size | number | Stored size |
| lastModified | date | Last modified date |
objectZip file info
Kind: inner typedef of Namespace
Properties
| Name | Type | Description |
|---|---|---|
| entries | Array.<ZipFileEntry> | files |
objectFile information
Kind: inner typedef of Namespace
Properties
| Name | Type | Description |
|---|---|---|
| namespace | string | Namespace file is stored in |
| md5 | string | MD5 hash string |
| contentType | string | File content type |
| size | number | File total length |
| metadata | object | Additional information |
| [metadata.image] | ImageInfo | Metadata for image files |
| [metadata.zip] | ZipInfo | Zip file entries |
objectFile converting options
Kind: inner typedef of Namespace
Properties
| Name | Type | Description |
|---|---|---|
| format | string | The output format, documents: pdf, image: gif, jpeg, png, webp, tiff |
| [resize] | string | For image, resize the image <width>x<height>{%}{@}{!}{<}{>} please check GraphicsMagick. notice: only {!}{>}{^} are available when the server is using ImageSharpConverter |
| [rotate] | string | number | For image, rotate the image by angle {auto}{90}{180}{270}, if auto is set, the angle will be detected by gravity from EXIF |
| [quality] | number | Forimage, set the output image quality 0 - 100, available for format jpeg, tiff, webp |
Example
Get a thumbnail of size 32px
{
format: 'jpeg',
resize: '32x32',
rotate: 'auto'
}
Example
Get a pdf version of a document
{
format: 'pdf',
}
MIT
FAQs
Client SDK for nexusdocs-server
We found that nexusdocs-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.