File Cabinet --> Other Binary File When a file ...
# suitescript
s
File Cabinet --> Other Binary File When a file is not a recognized type, NetSuite classifies it as 'Other Binary File' and when you call 'getContents' it returns a base64 Encoding. So for files that aren't in the cabinet but you know them as TXT, it's not impossible to process them without renaming them. For example: OFX files.. They are text, but NetSuite File Cabinet doesn't recognize them and returns content as base64.
This is the snippet I wrote to convert the Other Binary File to the Text version:
var ofxFile = file.load({ id: '1345' });
var ofxContents = ofxFile.getContents();
// If the type is 'Other Binary File', the 'isText' property will be false
if (!ofxFile.isText) {
ofxContents = encode.convert({
string: ofxContents,
inputEncoding: encode.Encoding.BASE_64,
outputEncoding: encode.Encoding.UTF_8
});
}