Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@openveo/api

Package Overview
Dependencies
Maintainers
4
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openveo/api - npm Package Compare versions

Comparing version 4.0.0-RC2 to 4.0.0

5

CHANGELOG.md

@@ -1,2 +0,2 @@

# 4.0.0 /
# 4.0.0 / 2017-05-04

@@ -33,2 +33,3 @@ ## BREAKING CHANGES

- util.shallowValidateObject is now capable to validate a timestamp as a string for a date
- Add require('@openveo/api').fileSystem.readdir function to get resources of a directory and all its sub directories

@@ -113,2 +114,2 @@ ## BUG FIXES

First stable version of OpenVeo API for [OpenVeo core](https://github.com/veo-labs/openveo-core) and plugins development.
First stable version of OpenVeo API for [OpenVeo core](https://github.com/veo-labs/openveo-core) and plugins development.

@@ -157,2 +157,77 @@ 'use strict';

/**
* Reads a directory content recursively and asynchronously.
*
* It is assumed that the directory exists.
*
* @method readdirRecursive
* @private
* @static
* @async
* @param {String} directoryPath Path of the directory
* @param {Function} callback The function to call when done
* - **Error** The error if an error occurred, null otherwise
* - **Array** The list of fs.Stats corresponding to resources inside the directory (files and directories)
*/
function readdirRecursive(directoryPath, callback) {
var resources = [];
// Read directory
fs.readdir(directoryPath, function(error, resourcesNames) {
// Failed reading directory
if (error) return callback(error);
var pendingResourceNumber = resourcesNames.length;
// No more pending resources, done for this directory
if (!pendingResourceNumber)
callback(null, resources);
// Iterate through the list of resources in the directory
resourcesNames.forEach(function(resourceName) {
var resourcePath = path.join(directoryPath, resourceName);
// Get resource stats
fs.stat(resourcePath, function(error, stats) {
if (error)
return callback(error);
stats.path = resourcePath;
resources.push(stats);
// Resource correspond to a directory
if (stats.isDirectory()) {
readdirRecursive(resourcePath, function(error, paths) {
if (error)
return callback(error);
resources = resources.concat(paths);
pendingResourceNumber--;
if (!pendingResourceNumber)
callback(null, resources);
});
} else {
// Resource does not correspond to a directory
// Mark resource as treated
pendingResourceNumber--;
if (!pendingResourceNumber)
callback(null, resources);
}
});
});
});
}
/**
* Copies a file.

@@ -480,1 +555,25 @@ *

};
/**
* Gets the content of a directory recursively and asynchronously.
*
* @method readdir
* @static
* @async
* @param {String} directoryPath Path of the directory
* @param {Function} callback The function to call when done
* - **Error** The error if an error occurred, null otherwise
* - **Array** The list of resources insides the directory
*/
module.exports.readdir = function(directoryPath, callback) {
if (!directoryPath || Object.prototype.toString.call(directoryPath) !== '[object String]')
return callback(new TypeError('Invalid directory path, expected a string'));
fs.stat(directoryPath, function(error, stat) {
if (error) callback(error);
else if (!stat.isDirectory())
callback(new Error(directoryPath + ' is not a directory'));
else
readdirRecursive(directoryPath, callback);
});
};

2

package.json
{
"name": "@openveo/api",
"version": "4.0.0-RC2",
"version": "4.0.0",
"description": "API for OpenVeo plugins",

@@ -5,0 +5,0 @@ "keywords": [

@@ -19,10 +19,10 @@ # OpenVeo API

Documentation is available on [Github pages](http://veo-labs.github.io/openveo-api/3.1.0).
Documentation is available on [Github pages](http://veo-labs.github.io/openveo-api/4.0.0).
# Contributors
Maintainer : [Veo-Labs](http://www.veo-labs.com/)
Maintainer: [Veo-Labs](http://www.veo-labs.com/)
# License
[AGPL](http://www.gnu.org/licenses/agpl-3.0.en.html)
[AGPL](http://www.gnu.org/licenses/agpl-3.0.en.html)

Sorry, the diff of this file is not supported yet

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