M8Test Help

zipFile

val filesDir = _files.getFilesDir() val src = _files.buildFile { setPath(filesDir, "tmp/abc.txt") } src.writeText("hello world", "UTF-8") val dest = _files.buildFile { setPath(filesDir, "tmp/abc.zip") } _console.log(_files.zipFile(src, dest, null)) _console.log(dest.exists() && dest.isFile()) src.delete() dest.delete()
def filesDir = $files.getFilesDir() def src = $files.buildFile { setPath(filesDir, "tmp/abc.txt") } src.writeText("hello world", "UTF-8") def dest = $files.buildFile { setPath(filesDir, "tmp/abc.zip") } $console.log($files.zipFile(src, dest, null)) $console.log(dest.exists() && dest.isFile()) src.delete() dest.delete()
let filesDir = $files.getFilesDir() let src = $files.buildFile((fileBuilder) => { fileBuilder.setPath(filesDir, "tmp/abc.txt") }) src.writeText("hello world", "UTF-8") let dest = $files.buildFile((fileBuilder) => { fileBuilder.setPath(filesDir, "tmp/abc.zip") }) $console.log($files.zipFile(src, dest, null)) $console.log(dest.exists() && dest.isFile()) src.delete() dest.delete()
local filesDir = _files:getFilesDir() local src = _files:buildFile(function(fileBuilder) fileBuilder:setPath(filesDir, "tmp/abc.txt") end) src:writeText("hello world", "UTF-8") local dest = _files:buildFile(function(fileBuilder) fileBuilder:setPath(filesDir, "tmp/abc.zip") end) _console:log(_files:zipFile(src, dest, nil)) _console:log(dest:exists() and dest:isFile()) src:delete() dest:delete()
<?php $filesDir = $files->getFilesDir(); $src = $files->buildFile(function ($fileBuilder) use ($filesDir) { $fileBuilder->setPath($filesDir, "tmp/abc.txt"); }); $src->writeText("hello world", "UTF-8"); $dest = $files->buildFile(function ($fileBuilder) use ($filesDir) { $fileBuilder->setPath($filesDir, "tmp/abc.zip"); }); $console->log($files->zipFile($src, $dest, null)); $console->log($dest->exists() and $dest->isFile()); $src->delete(); $dest->delete();
filesDir = _files.getFilesDir() def fn1(fileBuilder): fileBuilder.setPath(filesDir, "tmp/abc.txt") src = _files.buildFile(fn1) src.writeText("hello world", "UTF-8") def fn2(fileBuilder): fileBuilder.setPath(filesDir, "tmp/abc.zip") dest = _files.buildFile(fn2) _console.log(_files.zipFile(src, dest, None)) _console.log(dest.exists() and dest.isFile()) src.delete() dest.delete()
filesDir = $files.getFilesDir() src = $files.buildFile { |fileBuilder| fileBuilder.setPath(filesDir, "tmp/abc.txt") } src.writeText("hello world", "UTF-8") dest = $files.buildFile { |fileBuilder| fileBuilder.setPath(filesDir, "tmp/abc.zip") } $console.log($files.zipFile(src, dest, nil)) $console.log(dest.exists() && dest.isFile()) src.delete() dest.delete()
Last modified: 18 May 2025