Skip to content

Instantly share code, notes, and snippets.

@saml
Created June 11, 2013 13:50
Show Gist options
  • Save saml/5757015 to your computer and use it in GitHub Desktop.
Save saml/5757015 to your computer and use it in GitHub Desktop.
/**
* puts file to Storage .
*
* readBytes: File => Option[Array[Byte]]
* put: Array[Byte] => Id
*/
def putFrom(file: File, cleanUp: Boolean): Option[ID] = Exception.allCatch.andFinally {
if (cleanUp) file.delete()
} opt {
readBytes(file).map(put(_))
} flatten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment