New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

webdav

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webdav - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

2

API.md

@@ -337,3 +337,3 @@ ## Modules

```js
await client.moveFIle("/sub/file.dat", "/another/dir/file.dat");
await client.moveFile("/sub/file.dat", "/another/dir/file.dat");
```

@@ -340,0 +340,0 @@ <a name="ClientInterface.putFileContents"></a>

# WebDAV-Client changelog
## v2.3.0
_2019-01-22_
* [#134](https://github.com/perry-mitchell/webdav-client/issues/134) Allow access to all returned properties
## v2.2.1

@@ -4,0 +9,0 @@ _2019-01-10_

@@ -5,2 +5,10 @@ "use strict";

function extractKey(xmlKey) {
const match = /^([a-z0-9]+:)?(.+)$/i.exec(xmlKey);
if (!match) {
throw new Error(`Failed to extract key for response XML: ${xmlKey}`);
}
return match[2];
}
function findKey(baseKey, obj) {

@@ -29,3 +37,3 @@ return Object.keys(obj).find(function __findBaseKey(itemKey) {

function parseXML(xml) {
const parser = new xml2js.Parser({ ignoreAttrs: true });
const parser = new xml2js.Parser({ emptyTag: true, ignoreAttrs: true });
return new Promise(function (resolve, reject) {

@@ -41,3 +49,3 @@ parser.parseString(xml, function __handleParseResult(err, result) {

function propsToStat(props, filename) {
function propsToStat(props, filename, isDetailed = false) {
const path = require("path");

@@ -60,2 +68,7 @@ // Last modified time, raw size, item type and mime

}
if (isDetailed) {
stat.props = Object.keys(props).map(extractKey).reduce((output, propName) => Object.assign(output, {
[propName]: getSingleValue(getValueForKey(propName, props))
}), {});
}
return stat;

@@ -79,7 +92,7 @@ }

module.exports = {
getSingleValue: getSingleValue,
getValueForKey: getValueForKey,
parseXML: parseXML,
propsToStat: propsToStat,
translateDiskSpace: translateDiskSpace
getSingleValue,
getValueForKey,
parseXML,
propsToStat,
translateDiskSpace
};

@@ -50,6 +50,6 @@ "use strict";

return res.data;
}).then(parseXML).then(result => getDirectoryFiles(result, options.remotePath, remotePath)).then(files => processResponsePayload(response, files, options.details));
}).then(parseXML).then(result => getDirectoryFiles(result, options.remotePath, remotePath, options.details)).then(files => processResponsePayload(response, files, options.details));
}
function getDirectoryFiles(result, serverBasePath, requestPath) {
function getDirectoryFiles(result, serverBasePath, requestPath, isDetailed = false) {
const remoteTargetPath = pathPosix.join(serverBasePath, requestPath, "/");

@@ -77,3 +77,3 @@ const serverBase = pathPosix.join(serverBasePath, "/");

const filename = serverBase === "/" ? normalisePath(href) : normalisePath(pathPosix.relative(serverBase, href));
return propsToStat(props, filename);
return propsToStat(props, filename, isDetailed);
});

@@ -80,0 +80,0 @@ }

@@ -45,6 +45,6 @@ "use strict";

return res.data;
}).then(parseXML).then(xml => parseStat(xml, filename)).then(result => processResponsePayload(response, result, options.details));
}).then(parseXML).then(xml => parseStat(xml, filename, options.details)).then(result => processResponsePayload(response, result, options.details));
}
function parseStat(result, filename) {
function parseStat(result, filename, isDetailed = false) {
let responseItem = null,

@@ -64,3 +64,3 @@ multistatus;

const filePath = urlTools.normalisePath(filename);
return propsToStat(props, filePath);
return propsToStat(props, filePath, isDetailed);
}

@@ -67,0 +67,0 @@

{
"name": "webdav",
"version": "2.2.1",
"version": "2.3.0",
"description": "WebDAV client for NodeJS",

@@ -56,3 +56,3 @@ "main": "dist/index.js",

"url-parse": "^1.4.4",
"xml2js": "^0.4.17"
"xml2js": "^0.4.19"
},

@@ -59,0 +59,0 @@ "devDependencies": {

@@ -77,2 +77,6 @@ ![WebDAV](https://raw.githubusercontent.com/perry-mitchell/webdav-client/master/webdav.jpg)

#### Directory contents items
Each item returned by `getDirectoryContents` is basically an [item stat](#item-stat). If the `details: true` option is set, each item stat (as mentioned in the stat documentation) will also include the `props` property containing extra properties returned by the server. No particular property in `props`, not its format or value, is guaranteed.
#### Detailed responses

@@ -124,2 +128,3 @@

| mime | String | Files only | Mime type - for file items only |
| props | Object | `details: true` | Props object containing all item properties returned by the server |

@@ -126,0 +131,0 @@ ## Compatibility

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc