file/README.md
2024-10-11 12:02:48 +08:00

1.0 KiB

file for GoJS

usage

import (
	"apigo.cc/gojs"
	_ "apigo.cc/gojs/file"
)

func main() {
	r, err := gojs.Run(`
import file from 'apigo.cc/gojs/file'

function main(args){
	return file.read('test.txt')
}
	`, "test.js")

    fmt.Println(r, err)
}

cache file for proformance

import file from 'apigo.cc/gojs/file'
file.cache('test.txt', true)
file.cache('images/test.png')

module.exports

function read(filename: string): string {return ''}
function readBytes(filename: string): any {return null}
function write(filename: string, data: any): void {}
function dir(filename: string): Array<FileInfo> {return null as any}
function stat(filename: string): FileInfo {return null as any}
function find(filename: string): string {return ''}
function remove(filename: string): void {}
function rename(from: string, to: string): void {}
function copy(from: string, to: string): void {}
function cache(filename: string, isCompress: boolean): void {}

full api see file.ts