BinaryStream I/O Exception 21

Hi everyone,

I am trying to figure out what I am doing wrong on using the following code snippet to open a folderitem, convert it to a binarystream, and use that string content for an https post. Note that this code works well for the following file types I have tried (PNG, PDF, TXT, RTF) but it raises an I/O Exception #21 whenever I try to open a .app file. Any guidance would be appreciated.

Thanks
Mike

  Dim ourBinaryStream as BinaryStream
  
  // PREPARE THE PASSED FILE
  Dim theFile as FolderItem = inFoldername
  Dim theFileStr as String
  Dim theFileName as String = theFile.DisplayName
  
  
  // OPEN FILE AS A BINARY STREAM
  ourBinaryStream = BinaryStream.Open(theFile, False)
  theFileStr = ourBinaryStream.Read(ourBinaryStream.Length)
  ourBinaryStream.Close
  • Mac Platform

Ok so I figured out that the .app is a directory structure on mac (Which I forgot of course) and binarystream.open can only open a file.

Thanks!

You’ll have to package it into a single-file format such as tgz or Zip.

Thanks Paul! :slight_smile: I figured as such and thank you for confirming!!