2.0.2 • Published 2 years ago

@fileglass/arach-node v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

arach-node

A modern, promise based Node.js wrapper around the Project Arachnid CSAM API.

Options:

	apikey: string (required)
	url: string (required)
	trueOnError: boolean (default: true)
	exitOnErr: boolean (default: false)

Typescript example:

import Filter from "arach-node"
const arach = new Filter(options)
const file = someBuffer()
const resp = await arach.isImageSafe(file, "test.png", "image/png")
//resp =
/*
     safe: boolean
     rawResponse: Object[]
     errored: boolean
*/

Generics: The isImageSafe method has 2 generics (type arguments), both to manage the type safety. Usage: await arach.isImageSafe<true, true>(file, "test.png", "image/png") The example above turns off the strict typings of both string arguments, so any string format can be passed (normally ${string}.${string} and ${string}/${string} is allowed)

Error handling:

arach.onError((err: string, rawErr: any) => {
    //do something
})

Using streams:

Native streams are supported since V2, the convertStreamToBuffer function is deprecated.

const resp = await arach.isImageSafe(stream, "test.png", "image/png")
2.0.2

2 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago