import oxipng from './oxipng' ; import { EncodeOptions } from './types' ; import { defaultEncodeOptions } from './options' ; param { Buffer } image param { EncodeOptions } encodeOptions returns { Buffer } const encode = ( image , encodeOptions = { } ) : Buffer => { const filledEncodeOptions = { ... defaultEncodeOptions , ... encodeOptions } ; const result = oxipng . encode ( new Uint8Array ( image ) , filledEncodeOptions . level ) ; return Buffer . from ( result ) ; } ; export default encode ; module . exports = encode ;