Closed NeroSolomon closed 3 years ago
Hi!
I’m going to close this since it’s not really a bug report so much as a request for assistance, which I unfortunately don’t have the time to provide.
I did just create a discussion for this repo, as this is a not-infrequent issue that folks report. (It’s generally been, as you suspect, a usage problem rather than a bug in zmodem.js.)
Note that the distribution does include a bin/
directory that includes a CLI demonstration of the workflow you’re asking about.
The only suggestion I can offer is to ensure that your WebSocket connection is using binary messages. Text messages don’t work.
@FGasper Thanks a lot!
Describe the bug I use zmodemjs in xterm.js which version in 3.14.5, when enter sz, console get error: Uncaught Error: Unhandled header: ZRQINIT
What happens when you follow README.md’s TROUBLESHOOTING steps?
To Reproduce Steps to reproduce the behavior:
listen zmodemDetect after terminal inited
// download function downloadFile = (zsession: any) => { const self = this zsession.on('offer', (xfer: any) => { function on_form_submit() { const FILE_BUFFER: any[] = [] xfer.on('input', (payload: any) => { self.updateProgress(xfer) FILE_BUFFER.push(new Uint8Array(payload)) })
})
const promise = new Promise((res) => { zsession.on('session_end', () => { console.log('-----zession close----') res('') }) })
zsession.start() return promise }
// save file function saveFile = (xfer, buffer) => { return Zmodem.Browser.save_to_disk(buffer, xfer.get_details().name) }