How to use the ssh2-streams.SFTPStream.flagsToString function in ssh2-streams

To help you get started, we’ve selected a few ssh2-streams examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tkambler / sftp-server / lib / components / stream-manager / index.js View on Github external
onOPEN(reqID, filename, flags, attrs) {

            const localPath = this.getLocalPath(filename);

            log.debug('onOPEN', {
                'reqID': reqID,
                'filename': filename,
                'localPath': localPath,
                'flags': flags
            });

            let adapter;
            flags = SFTPStream.flagsToString(flags);

            log.debug('flags', flags);

            switch (flags) {
                case 'r':
                    if (!this.canRead(localPath)) {
                        return this.sendStatus(reqID, STATUS_CODE.FAILURE);
                    }
                    adapter = new FileReader(this, localPath, flags, attrs);
                break;
                case 'w':
                    if (!this.canWrite(localPath)) {
                        return this.sendStatus(reqID, STATUS_CODE.FAILURE);
                    }
                    adapter = new FileWriter(this, localPath, flags, attrs);
                break;

ssh2-streams

SSH2 and SFTP(v3) client/server protocol streams for node.js

MIT
Latest version published 5 years ago

Package Health Score

70 / 100
Full package analysis