Skip to content

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

License

Notifications You must be signed in to change notification settings

fileglass/arach-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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")

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •