Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/vfs/iovfs/iofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"io/fs"
"strings"
"unsafe"

"github.com/microsoft/typescript-go/internal/stringutil"
"github.com/microsoft/typescript-go/internal/tspath"
Expand Down Expand Up @@ -65,7 +66,8 @@ func From(fsys fs.FS, useCaseSensitiveFileNames bool) vfs.FS {
// \xEF\xBB\xBF.
content = stringutil.AddUTF8ByteOrderMark(content)
}
return fsys.WriteFile(rest, []byte(content), 0o666)
buf := unsafe.Slice(unsafe.StringData(content), len(content))
return fsys.WriteFile(rest, buf, 0o666)
}
mkdirAll = func(path string) error {
rest, _ := strings.CutPrefix(path, "/")
Expand Down
Loading