silverwolf-x's picture
download
raw
876 Bytes
import { useCallback } from 'react'
export function useOpenInEditor({
file,
line1,
column1,
}: {
file?: string | null
line1?: number | null
column1?: number | null
} = {}) {
const openInEditor = useCallback(() => {
if (file == null || line1 == null || column1 == null) return
const params = new URLSearchParams()
params.append('file', file)
params.append('line1', String(line1))
params.append('column1', String(column1))
self
.fetch(
`${
process.env.__NEXT_ROUTER_BASEPATH || ''
}/__nextjs_launch-editor?${params.toString()}`
)
.then(
() => {},
(cause) => {
console.error(
`Failed to open file "${file} (${line1}:${column1})" in your editor. Cause:`,
cause
)
}
)
}, [file, line1, column1])
return openInEditor
}

Xet Storage Details

Size:
876 Bytes
·
Xet hash:
53eec078f12fb5daa2fcceb303d311e24b4c93f4b101ce46994a88b7c2a72b0a

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.