@sealsystems/ipp
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -155,13 +155,13 @@ 'use strict'; | ||
'Add-Document-Images', | ||
'Acknowledge-Document', | ||
'Acknowledge-Identify-Printer', | ||
'Acknowledge-Job', | ||
'Fetch-Document', | ||
'Fetch-Job', | ||
'Get-Output-Device-Attributes', | ||
'Update-Active-Jobs', | ||
'Deregister-Output-Device', | ||
'Update-Document-Status', | ||
'Update-Job-Status', | ||
'Update-Output-Device-Attributes', | ||
'Acknowledge-Document', // 0x3f http://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf | ||
'Acknowledge-Identify-Printer', // 0x40 http://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf | ||
'Acknowledge-Job', // 0x41 http://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf | ||
'Fetch-Document', // 0x42 http://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf | ||
'Fetch-Job', // 0x43 http://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf | ||
'Get-Output-Device-Attributes', // 0x44 http://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf | ||
'Update-Active-Jobs', // 0x45 http://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf | ||
'Deregister-Output-Device', // 0x46 http://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf | ||
'Update-Document-Status', // 0x47 http://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf | ||
'Update-Job-Status', // 0x48 http://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf | ||
'Update-Output-Device-Attributes', // 0x49 http://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf | ||
'Get-Next-Document-Data', | ||
@@ -173,3 +173,3 @@ 'Allocate-Printer-Resources', | ||
'Get-Printers', | ||
'Shutdown-One-Printer', | ||
'Shutdown-One-Printer', // 0x50 | ||
'Startup-One-Printer', | ||
@@ -190,3 +190,3 @@ 'Cancel-Resource', | ||
'Register-Output-Device', | ||
'Restart-System', | ||
'Restart-System', // 0x60 | ||
'Resume-All-Printers', | ||
@@ -193,0 +193,0 @@ 'Set-System-Attributes', |
'use strict'; | ||
const parseurl = require('url').parse; | ||
const { PassThrough } = require('stream'); | ||
const extend = require('./ipputil').extend, | ||
request = require('./request'), | ||
serialize = require('./serializer'); | ||
const extend = require('./ipputil').extend; | ||
const request = require('./request'); | ||
const serialize = require('./serializer'); | ||
const isReadableStream = require('./isReadableStream'); | ||
@@ -50,3 +52,3 @@ /* eslint-disable no-implicit-globals */ | ||
} else if (msg && msg['operation-attributes-tag']['job-uri']) { | ||
// yes, this gets done in extend()- however, by doing this now, we define the position in the result object. | ||
// yes, this gets done in extend() - however, by doing this now, we define the position in the result object. | ||
base['operation-attributes-tag']['job-uri'] = msg['operation-attributes-tag']['job-uri']; | ||
@@ -71,2 +73,10 @@ } | ||
if (msg.data && isReadableStream(msg.data)) { | ||
const stream = new PassThrough(); | ||
request(this.url, stream, cb); | ||
stream.write(buf); | ||
return msg.data.pipe(stream); | ||
} | ||
request(this.url, buf, cb); | ||
@@ -73,0 +83,0 @@ } |
'use strict'; | ||
const http = require('http'), | ||
https = require('https'), | ||
url = require('url'); | ||
const http = require('http'); | ||
const https = require('https'); | ||
const url = require('url'); | ||
const isReadableStream = require('./isReadableStream'); | ||
const parse = require('./parser'); | ||
@@ -36,3 +37,3 @@ | ||
const request = (opts, buffer, cb) => { | ||
// const streamed = typeof buffer === 'function'; | ||
const isStream = isReadableStream(buffer); | ||
@@ -42,3 +43,3 @@ // All IPP requires are POSTs- so we must have some data. | ||
if (!Buffer.isBuffer(buffer) || buffer.length < 10) { | ||
if (!isStream && (!Buffer.isBuffer(buffer) || buffer.length < 10)) { | ||
return cb(new Error('Data required')); | ||
@@ -68,4 +69,4 @@ } | ||
const req = (opts.protocol === 'https:' ? https : http).request(opts, (res) => { | ||
// console.log('STATUS: ' + res.statusCode); | ||
// console.log('HEADERS: ' + JSON.stringify(res.headers)); | ||
// console.log('STATUS: ' + res.statusCode); | ||
// console.log('HEADERS: ' + JSON.stringify(res.headers)); | ||
switch (res.statusCode) { | ||
@@ -82,5 +83,4 @@ case 100: | ||
default: | ||
// console.log(res.statusCode, 'response'); | ||
cb(new IppResponseError(res.statusCode)); | ||
// console.log(res.statusCode, 'response'); | ||
} | ||
@@ -97,6 +97,10 @@ }); | ||
} | ||
req.write(buffer); | ||
req.end(); | ||
if (isStream) { | ||
buffer.pipe(req); | ||
} else { | ||
req.write(buffer); | ||
req.end(); | ||
} | ||
}; | ||
module.exports = request; |
'use strict'; | ||
const attributes = require('./attributes'), | ||
enums = require('./enums'), | ||
keywords = require('./keywords'), | ||
operations = require('./enums')['operations-supported'], | ||
statusCodes = require('./statusCodes'), | ||
tags = require('./tags'), | ||
versions = require('./versions'); | ||
const attributes = require('./attributes'); | ||
const enums = require('./enums'); | ||
const keywords = require('./keywords'); | ||
const operations = require('./enums')['operations-supported']; | ||
const statusCodes = require('./statusCodes'); | ||
const tags = require('./tags'); | ||
const versions = require('./versions'); | ||
const isReadableStream = require('./isReadableStream'); | ||
const RS = '\u001e'; | ||
@@ -353,3 +355,3 @@ | ||
if (!msg.data) { | ||
if (!msg.data || isReadableStream(msg.data)) { | ||
return buf.slice(0, position); | ||
@@ -359,3 +361,3 @@ } | ||
if (!Buffer.isBuffer(msg.data)) { | ||
throw new Error('data must be a Buffer'); | ||
throw new Error('Data must be a Buffer or a stream.Readable.'); | ||
} | ||
@@ -362,0 +364,0 @@ |
{ | ||
"name": "@sealsystems/ipp", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Internet Printing Protocol (IPP) for nodejs", | ||
@@ -9,4 +9,4 @@ "keywords": ["ipp", "print", "printing"], | ||
"release": "bot release && npm publish", | ||
"release-minor": "bot release --type minor && npm publish", | ||
"release-major": "bot release --type major && npm publish", | ||
"release-minor": "bot release --type minor && npm publish --access public", | ||
"release-major": "bot release --type major && npm publish --access public", | ||
"test": "bot test-units", | ||
@@ -21,3 +21,3 @@ "coverage": "istanbul cover _mocha -- --recursive --ui tdd ", | ||
}, | ||
"author": [ | ||
"contributors": [ | ||
{ | ||
@@ -37,3 +37,6 @@ "name": "William Kapke", | ||
"concat-stream": "1.6.0", | ||
"express": "4.16.2", | ||
"freeport": "1.0.5", | ||
"pdfkit": "0.8.3", | ||
"raw-body": "2.3.2", | ||
"roboter": "0.16.0", | ||
@@ -40,0 +43,0 @@ "roboter-server": "0.16.0" |
# @sealsystems/ipp - Internet Printing Protocol (IPP) for Node.js | ||
[![NPM](https://img.shields.io/npm/v/@sealsystems/ipp.svg)](https://www.npmjs.com/package/@sealsystems/ipp) | ||
[![CircleCI](https://circleci.com/gh/sealsystems/node-ipp.svg?style=svg)](https://circleci.com/gh/sealsystems/node-ipp) | ||
@@ -4,0 +5,0 @@ [![Build status](https://ci.appveyor.com/api/projects/status/vl62lopukvo2lyd0?svg=true)](https://ci.appveyor.com/project/StefanScherer/node-ipp) |
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
146011
16
3949
1
145
9