Test Enterprise-Class Web CMS Scrivito Free for 30 Days
Test Scrivito Free for 30 Days


Prepares the Binary instance for copying. Returns a FutureBinary.

Note: This does not perform the actual copying. The actual copying can be triggered by putting the returned FutureBinary into an Obj.


  • options (optional) (Object) - Options to pass when copying a Binary:
    • filename (String) - The new file name.
    • contentType (String) - A content type for overriding the original contentType.


  • ArgumentError - If any of the passed-in options are blank.




Create a copy of a random image. This involves three steps, creating the new image object, copying the blob of the source image, and placing this copy into the new object, with a new filename.

sourceImage = Scrivito.getClass("Image").all().first();
targetImage = Scrivito.getClass("Image").create({ });
betterName = "better-than-the-old-one." + sourceImage.contentType();
futureBinary = sourceImage.get("blob").copy({ filename: betterName });
futureBinary.into(sourceImage).then(copiedBinary => sourceImage.update({ blob: copiedBinary }));