file.load of N/file

The file.load loads an existing file from the NetSuite File Cabinet. This function retrieves the file based on its internal ID and returns a file object.

let fileObj = file.load(

{

          id: fileId //The internal ID of the file you want to load.

});

The returned file object includes several properties:

  • id : The internal ID of the file.
  • name : The name of the file.
  • fileType : The type of the file
  • folder : The internal ID of the folder where the file is stored.
  • size : The size of the file in bytes.
  • url : The URL to the file in the File Cabinet.
  • contents : The contents of the file as a string

Properties and Methods of the File Object:

  • fileObj.name : Returns the name of the file.
  • fileObj.url : Returns the URL to the file in the File Cabinet.
  • fileObj.size : Returns the size of the file in bytes.
  • fileObj.getContents() : Retrieves the content of the file as a string

Leave a comment

Your email address will not be published. Required fields are marked *