import { Type } from './Type' ; import type { Platform } from '../platforms' ; import type { EntityProperty } from '../typings' ; export class BlobType extends Type < Buffer | null > { convertToDatabaseValue ( value , platform ) { return value ; } convertToJSValue ( value , platform ) { if ( value as unknown instanceof Buffer || ! value ) { return value ; } if ( value . buffer instanceof Buffer ) { return value . buffer ; } return Buffer . from ( value ) ; } compareAsType ( ) { return 'Buffer' ; } getColumnType ( prop , platform ) { return platform . getBlobDeclarationSQL ( ) ; } }