import { ValidateBy } from 'class-validator' ; export class IsBufferEncodingConstraint { validate ( value ) { return Buffer . isEncoding ( value ) ; } } export function IsBufferEncoding ( ) { return ValidateBy ( { name : 'IsBufferEncoding' , validator : IsBufferEncodingConstraint , } ) ; }