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

app-size

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

app-size - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

26

cli.js
#!/usr/bin/env node
'use strict';
var meow = require('meow');
var appSize = require('./');
const meow = require('meow');
const prettyBytes = require('pretty-bytes');
const appSize = require('./');
var cli = meow({
help: [
'Examples',
' $ app-size Safari',
' $ app-size /Applications/Safari.app',
' $ app-size com.apple.Safari'
]
});
const cli = meow(`
Example
$ app-size Safari
$ app-size /Applications/Safari.app
$ app-size com.apple.Safari
`);

@@ -20,7 +19,2 @@ if (!cli.input.length) {

appSize(cli.input[0])
.then(console.log)
.catch(function (err) {
console.error(err.message);
process.exit(1);
});
appSize(cli.input[0]).then(res => console.log(prettyBytes(res)));
'use strict';
var execFile = require('child_process').execFile;
var fs = require('fs');
var pify = require('pify');
var Promise = require('pinkie-promise');
var appPath = require('app-path');
const fs = require('fs');
const appPath = require('app-path');
const execa = require('execa');
const pify = require('pify');
function getSize(path) {
var cmd = 'mdls';
var args = [
const getSize = path => {
const cmd = 'mdls';
const args = [
'-name',

@@ -17,11 +16,8 @@ 'kMDItemFSSize',

return pify(execFile, Promise)(cmd, args)
.then(function (size) {
return parseInt(size, 10);
});
}
return execa(cmd, args).then(res => parseInt(res.stdout, 10));
};
module.exports = function (app) {
module.exports = app => {
if (process.platform !== 'darwin') {
return Promise.reject(new Error('Only OS X systems are supported'));
return Promise.reject(new Error('Only OS X is supported'));
}

@@ -34,3 +30,3 @@

return pify(fs.stat)(app)
.then(function (stats) {
.then(stats => {
if (!stats.isDirectory()) {

@@ -42,5 +38,5 @@ return Promise.reject(new Error('Expected an application'));

})
.catch(function (err) {
.catch(err => {
if (err && err.code === 'ENOENT') {
return pify(appPath, Promise)(app).then(getSize);
return appPath(app).then(getSize);
}

@@ -47,0 +43,0 @@

{
"name": "app-size",
"version": "2.0.0",
"version": "3.0.0",
"description": "Get an .app's size in byte",

@@ -14,3 +14,3 @@ "license": "MIT",

"engines": {
"node": ">=0.10.0"
"node": ">=4"
},

@@ -34,11 +34,11 @@ "scripts": {

"dependencies": {
"app-path": "^1.0.1",
"app-path": "^2.1.0",
"execa": "^0.3.0",
"meow": "^3.3.0",
"pify": "^2.2.0",
"pinkie-promise": "^1.0.0"
"pretty-bytes": "^3.0.1"
},
"devDependencies": {
"ava": "^0.2.0",
"xo": "^0.9.0"
"ava": "*",
"xo": "*"
}
}

@@ -16,3 +16,3 @@ # app-size [![Build Status](https://travis-ci.org/gillstrom/app-size.svg?branch=master)](https://travis-ci.org/gillstrom/app-size)

```js
var appSize = require('app-size');
const appSize = require('app-size');

@@ -45,3 +45,3 @@ appSize('Safari').then(size => {

Examples
Example
$ app-size Safari

@@ -48,0 +48,0 @@ $ app-size /Applications/Safari.app

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