@fileglass/arach-node
v2.0.2
Published
node.js wrapper for the Arachnid CSAM filter
Downloads
11
Readme
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")