A modern, promise based Node.js wrapper around the Project Arachnid CSAM API.
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)
arach.onError((err: string, rawErr: any) => {
//do something
})
Native streams are supported since V2, the convertStreamToBuffer
function is deprecated.
const resp = await arach.isImageSafe(stream, "test.png", "image/png")