Giter Site home page Giter Site logo

atom-filesize's Introduction

filesize package for Atom

This package is intended for use with the Atom Editor and it displays the size of the focused file in the status-bar component included with Atom.

Bonus: If you click on the filesize component it will show a tooltip with more information about the file, try it out!

It works great with your new theme! The popups tries to follow your current theme's style, try switching themes and see for yourself.

New in 4.0.0: Remote file support. Now you can quickly check the estimated size of your remote project files. This includes support for the popular nuclide extension. More details of the implementation below.

Get it now

If you have Atom Shell Commands run this on your terminal to get it now:

apm install filesize

You can also find this package searching for filesize in the Atom package browser inside Settings.

Screenshots

filesize with popup opened in One Dark theme.

filesize with popup opened in Solarized Light theme while inspecting the above screenshot. Screenception!

How it works

It uses Node.JS's fs module to calculate the size in bytes of the current file in focus.

If the popup is enabled (by default it is), it fetches some additional info you might want to see:

  • Absolute path
  • Mime type
  • Creation date
  • Date of last change
  • Dimensions (if it's an image)

It works along side the status-bar component, so you need to have both enabled. The status-bar component is installed and enabled by default by Atom. Thus, usually, you won't need to worry about it.

Remote files

Since 4.0.0 filesize supports remote files. The extension is basically reading the editor buffer to estimate the file size.

The estimated size is identified by the ~ symbol before the formatted size in the status bar.

Tooltip detailed info does not feature the whole set of information.

When working with remote files the extension does not have access to the whole file metadata, so we are showing estimated size only. This may change in future releases.

Settings

The package has three settings located in Settings->Packages->filesize:

  • Use Decimal, whether you want to show the size using Decimal or IEC/ISO80000. It defaults to using the IEC representation.
  • Enable Popup Appearance, whether the popup will show on clicking the filesize component on the status bar. Defaults to showing the popup.
  • Display Full Day Time On Popup, whether to use 24 or 12 hour time display. It defaults to using the 24-hour format.
  • Display Gzipped Size on Popup, whether to enable gzip size appearance on the popup.

Contributing

You are welcome to send any issues or pull requests.

The current styleguide for the project is Airbnb's JavaScript Styleguide.

Please run eslint with npm run lint and apm test before sending commits.

Any bugs? Please file an issue

Wanna fix it? Please send a pull request.

Authors

atom-filesize's People

Contributors

mkxml avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hmatsuda famorted

atom-filesize's Issues

Doesn't work on remote files

Presumably on any remote file system, though I'm using nuclide.

Can the # of characters just be counted instead of hitting the filesystem?

Make the popup optional via config

It should be nice to add the config option to not show the popup at all and keep the old behavior as it's a little bit less load for Atom if you won't use the popup anyway.

The popup should be on by default with the possibility to turn it off.

Changes required for upcoming CoffeeScript upgrade

Hi! Thanks for maintaining the filesize package!

In Atom v1.12, we are going to upgrade CoffeeScript to the latest version. This upgrade entails one potentially breaking change to the language:

Changed strategy for the generation of internal compiler variable names. Note that this means that @example function parameters are no longer available as naked example variables within the function body.

We think your package may be affected by this upgrade, in the following places:

  • The multiple variable here

These findings are based on linting packages with coffeescope. We could be wrong about some of them. When we release v1.12 beta, please test your package against it to make sure that it works. Let me know if you have any further questions; I will be happy to help!

Update the README

When 0.3.0 is ready to ship the README must be updated informing the users about the new features and changes.

Uncaught TypeError: statusBar.appendLeft is not a function

Upon startup

Atom Version: 1.2.0-beta0
System: Debian GNU/Linux
Thrown From: filesize package, v0.2.0

Stack Trace

Uncaught TypeError: statusBar.appendLeft is not a function

At /home/capaj/.atom/packages/filesize/lib/filesize-view.coffee:28

TypeError: statusBar.appendLeft is not a function
    at FilesizeView.module.exports.FilesizeView.show (/home/capaj/.atom/packages/filesize/lib/filesize-view.coffee:28:18)
    at FilesizeView.module.exports.FilesizeView.display (/home/capaj/.atom/packages/filesize/lib/filesize-view.coffee:20:8)
    at FilesizeCalculator.<anonymous> (/home/capaj/.atom/packages/filesize/lib/filesize.coffee:65:23)
    at FilesizeCalculator.module.exports.FilesizeCalculator.makeReadable (/home/capaj/.atom/packages/filesize/lib/filesize-calculator.coffee:93:16)
    at /home/capaj/.atom/packages/filesize/lib/filesize-calculator.coffee:38:8
    at /home/capaj/.atom/packages/filesize/lib/filesize-calculator.coffee:66:20
    at FSReqWrap.oncomplete (fs.js:82:15)

Commands

Config

{
  "core": {}
}

Installed Packages

# User
autoclose-html, v0.19.0
autocomplete-html-entities, v0.1.0
autocomplete-modules, v1.3.1
autocomplete-paths, v1.0.2
coffee-links, v0.1.0
coffee-refactor, v0.7.0
editorconfig, v1.2.0
file-type-icons, v0.7.3
filesize, v0.2.0
hyperclick, v0.0.32
js-hyperclick, v1.3.0
js-refactor, v0.6.0
jspm-dev-buddy, v0.0.1
language-cjsx, v0.3.0
language-diff, v0.3.1
language-dotenv, v1.0.0
language-gitignore, v0.2.0
language-nginx, v0.6.1
language-soy, v0.3.0
linter, v1.10.0
linter-js-standard, v3.2.1
local-history, v3.2.3
open-recent, v2.3.0
react, v0.12.10
refactor, v0.6.0
standard-formatter, v1.2.0
tabs-to-spaces, v0.11.1

# Dev
No dev packages

Failed to activate the filesize package

I got this error after updating to 1.11.0

Atom Version: 1.11.0
Electron Version: 0.37.8
System: Mac OS X 10.12.1
Thrown From: filesize package, v0.4.2

Stack Trace

Failed to activate the filesize package

At Arguments to CompositeDisposable.add must have a .dispose() method

TypeError: Arguments to CompositeDisposable.add must have a .dispose() method
    at assertDisposable (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/composite-disposable.js:70:13)
    at CompositeDisposable.module.exports.CompositeDisposable.add (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/composite-disposable.js:43:11)
    at Object.module.exports.activate (/Users/montogeek/.atom/packages/filesize/lib/filesize.coffee:46:18)
    at Package.module.exports.Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:183:20)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:156:32
    at Package.module.exports.Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:92:15)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:149:26
    at Package.module.exports.Package.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:146:34)
    at PackageManager.module.exports.PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:538:21)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:519:29
    at Config.module.exports.Config.transactAsync (/Applications/Atom.app/Contents/Resources/app.asar/src/config.js:337:18)
    at PackageManager.module.exports.PackageManager.activatePackages (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:514:19)
    at PackageManager.module.exports.PackageManager.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:497:46)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/atom-environment.js:779:28

Commands

     -0:01.8.0 tree-view:reveal-active-file (atom-workspace.workspace.scrollbars-visible-always.seti-ui-no-icons.theme-one-dark-syntax.theme-genesis-ui)

Config

{
  "core": {
    "customFileTypes": {
      "source.ini": [
        ".buckconfig",
        ".flowconfig",
        ".hgrc"
      ],
      "source.json": [
        ".arcconfig",
        "BUCK.autodeps"
      ],
      "source.python": [
        "BUCK"
      ]
    },
    "disabledPackages": [
      "tabs-to-spaces",
      "editorconfig",
      "git-time-machine",
      "language-thrift",
      "tree-view",
      "enzyme-snippets",
      "linter"
    ],
    "excludeVcsIgnoredPaths": false,
    "themes": [
      "genesis-ui",
      "one-dark-syntax"
    ]
  }
}

Installed Packages

# User
atom-chai-snippets, v0.3.0 (inactive)
atom-material-ui, v1.3.6 (inactive)
atom-panda-syntax, v0.13.0 (inactive)
docblockr, v0.8.7 (inactive)
duotone-dark-red-syntax, v0.3.2 (inactive)
editorconfig, v1.4.1 (inactive)
emmet, v2.4.3 (inactive)
enzyme-snippets, v0.1.0 (inactive)
file-icons, v1.7.20 (inactive)
filesize, v0.4.2 (inactive)
genesis-ui, v0.5.0 (inactive)
git-plus, v5.18.0 (inactive)
haskell-grammar, v0.4.0 (inactive)
highlight-selected, v0.11.2 (inactive)
language-babel, v2.44.1 (inactive)
language-ini, v1.16.0 (inactive)
language-ocaml, v1.1.2 (inactive)
language-swift, v0.4.0 (inactive)
language-thrift, v1.0.2 (inactive)
linter, v1.11.18 (inactive)
linter-eslint, v8.0.0 (inactive)
material-ui, v1.0.9 (inactive)
merge-conflicts, v1.4.4 (inactive)
nova-atom-syntax, v1.3.1 (inactive)
nova-atom-ui, v1.2.3 (inactive)
nuclide, v0.175.0 (inactive)
nuclide-format-js, v0.0.36 (inactive)
oceanic-next, v0.4.0 (inactive)
pigments, v0.37.0 (inactive)
pretty-json, v1.6.1 (inactive)
project-manager, v3.2.3 (inactive)
react-es6-snippets, v0.3.0 (inactive)
seti-ui, v1.3.2 (inactive)
sort-lines, v0.14.0 (inactive)
synced-sidebar, v0.4.3 (inactive)
tool-bar, v1.0.1 (inactive)
vim-mode-plus, v0.60.0 (inactive)
wakatime, v6.0.10 (inactive)
atom-dark-syntax, v0.27.0 (inactive)
atom-dark-ui, v0.52.0 (inactive)
atom-light-syntax, v0.28.0 (inactive)
atom-light-ui, v0.44.0 (inactive)
base16-tomorrow-dark-theme, v1.2.0 (inactive)
base16-tomorrow-light-theme, v1.2.0 (inactive)
one-dark-ui, v1.6.0 (inactive)
one-light-ui, v1.6.0 (inactive)
one-dark-syntax, v1.3.0 (inactive)
one-light-syntax, v1.3.0 (inactive)
solarized-dark-syntax, v1.0.2 (inactive)
solarized-light-syntax, v1.0.2 (inactive)
about, v1.7.0 (inactive)
archive-view, v0.61.1 (inactive)
autocomplete-atom-api, v0.10.0 (inactive)
autocomplete-css, v0.11.2 (inactive)
autocomplete-html, v0.7.2 (inactive)
autocomplete-plus, v2.31.1 (inactive)
autocomplete-snippets, v1.11.0 (inactive)
autoflow, v0.27.0 (inactive)
autosave, v0.23.1 (inactive)
background-tips, v0.26.1 (inactive)
bookmarks, v0.42.0 (inactive)
bracket-matcher, v0.82.1 (inactive)
command-palette, v0.38.0 (inactive)
deprecation-cop, v0.54.1 (inactive)
dev-live-reload, v0.47.0 (inactive)
encoding-selector, v0.22.0 (inactive)
exception-reporting, v0.40.0 (inactive)
find-and-replace, v0.201.1 (inactive)
fuzzy-finder, v1.4.0 (inactive)
git-diff, v1.1.0 (inactive)
go-to-line, v0.31.0 (inactive)
grammar-selector, v0.48.2 (inactive)
image-view, v0.59.0 (inactive)
incompatible-packages, v0.26.1 (inactive)
keybinding-resolver, v0.35.0 (inactive)
line-ending-selector, v0.5.0 (inactive)
link, v0.31.1 (inactive)
markdown-preview, v0.158.0 (inactive)
metrics, v1.0.0 (inactive)
notifications, v0.65.1 (inactive)
open-on-github, v1.2.0 (inactive)
package-generator, v1.0.0 (inactive)
settings-view, v0.242.2 (inactive)
snippets, v1.0.2 (inactive)
spell-check, v0.68.2 (inactive)
status-bar, v1.4.1 (inactive)
styleguide, v0.47.0 (inactive)
symbols-view, v0.113.1 (inactive)
tabs, v0.101.0 (inactive)
timecop, v0.33.2 (inactive)
tree-view, v0.209.3 (inactive)
update-package-dependencies, v0.10.0 (inactive)
welcome, v0.35.1 (inactive)
whitespace, v0.33.0 (inactive)
wrap-guide, v0.38.2 (inactive)
language-c, v0.52.1 (inactive)
language-clojure, v0.21.0 (inactive)
language-coffee-script, v0.47.2 (inactive)
language-csharp, v0.12.1 (inactive)
language-css, v0.37.1 (inactive)
language-gfm, v0.88.0 (inactive)
language-git, v0.15.0 (inactive)
language-go, v0.42.1 (inactive)
language-html, v0.45.1 (inactive)
language-hyperlink, v0.16.0 (inactive)
language-java, v0.23.0 (inactive)
language-javascript, v0.119.0 (inactive)
language-json, v0.18.2 (inactive)
language-less, v0.29.5 (inactive)
language-make, v0.22.2 (inactive)
language-mustache, v0.13.0 (inactive)
language-objective-c, v0.15.1 (inactive)
language-perl, v0.35.0 (inactive)
language-php, v0.37.2 (inactive)
language-property-list, v0.8.0 (inactive)
language-python, v0.45.0 (inactive)
language-ruby, v0.69.0 (inactive)
language-ruby-on-rails, v0.25.0 (inactive)
language-sass, v0.56.0 (inactive)
language-shellscript, v0.22.4 (inactive)
language-source, v0.9.0 (inactive)
language-sql, v0.23.0 (inactive)
language-text, v0.7.1 (inactive)
language-todo, v0.28.0 (inactive)
language-toml, v0.18.0 (inactive)
language-xml, v0.34.9 (inactive)
language-yaml, v0.26.0 (inactive)

# Dev
No dev packages

Atom.Object.defineProperty.get is deprecated.

atom.workspaceView is no longer available.
In most cases you will not need the view. See the Workspace docs for
alternatives: https://atom.io/docs/api/latest/Workspace.
If you do need the view, please use atom.views.getView(atom.workspace),
which returns an HTMLElement.

Atom.Object.defineProperty.get (/Users/mischa/Applications/Atom.app/Contents/Resources/app/src/atom.js:54:11)
FilesizeView.hide (/Users/mischa/.atom/packages/filesize/lib/filesize-view.coffee:54:23)

One Light Theme

Do you have any plans to add support for the One Light Theme ?

Change the tooltip showing from focus to click

I think it's best to show it on click instead of on hover because that way you can keep the popup open while moving your mouse to select something inside it.

The other reason this should be fine is that the other elements inside the status bar all activate by click, so the user is expecting this kind of behavior.

Failed to load the filesize package

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.14.4 x64
Electron: 1.3.13
OS: Microsoft Windows 7 Ultimate
Thrown From: filesize package 2.0.4

Stack Trace

Failed to load the filesize package

At Cannot find module 'filesize-calculator'

Error: Cannot find module 'filesize-calculator'
    at Module._resolveFilename (module.js:455:15)
    at Module._resolveFilename (~/AppData/Local/atom/app-1.14.4/resources/electron.asar/common/reset-search-paths.js:35:12)
    at Function.Module._resolveFilename (/app.asar/src/module-cache.js:383:52)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (/app.asar/src/native-compile-cache.js:50:27)
    at /packages/atom-filesize/lib/filesize-view.js:4:34)
    at Module._compile (/app.asar/src/native-compile-cache.js:109:30)
    at /app.asar/src/compile-cache.js:216:21)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (/app.asar/src/native-compile-cache.js:50:27)
    at /packages/atom-filesize/lib/filesize.js:4:55)
    at Module._compile (/app.asar/src/native-compile-cache.js:109:30)
    at /app.asar/src/compile-cache.js:216:21)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (/app.asar/src/native-compile-cache.js:50:27)
    at Package.module.exports.Package.requireMainModule (/app.asar/src/package.js:796:27)
    at /app.asar/src/package.js:123:28
    at Package.module.exports.Package.measure (/app.asar/src/package.js:96:15)
    at Package.module.exports.Package.load (/app.asar/src/package.js:110:12)
    at PackageManager.module.exports.PackageManager.loadPackage (/app.asar/src/package-manager.js:468:14)
    at /app.asar/src/package-manager.js:412:19
    at Config.module.exports.Config.transact (/app.asar/src/config.js:312:16)
    at PackageManager.module.exports.PackageManager.loadPackages (/app.asar/src/package-manager.js:407:19)

Commands

     -0:15.9.0 tree-view:show (atom-workspace.workspace.scrollbars-visible-always.theme-solarized-dark-syntax.theme-one-dark-ui)

Non-Core Packages

file-icons 2.0.17 
filesize 2.0.4 
javascript-snippets 1.2.1 
color-picker 2.2.5 
linter 1.99.0 

ES2015 refactor

Related to #13. Let's simplify the codebase and move it into a pure JS/ES2015 compatible code.

Add Gzipped size

I think it would be useful to add the gzipped size to the popup set of stats.

Loading time

I've been noticing recently that atom-filesize consistently appears at the very top of the timecop "Package Loading" list. For the relative scope of the package I'm slightly surprised that the overheads seem (relatively) so significant, for me at least. Do others experience this also, is it a known issue?

filesize_load_time

I did notice, (I think) after a recent update, that the atom-filesize contribution to the "Package Activation" top list had gone. Is there anything that can be done to lower the loading time in the same direction? :)

Add option allowing the user to choose the hour format

This is related to issue #2.

In the newly implemented popup there are two properties that show time: Creation time and Last Changed.

It would be nice to add an option to choose between 24 and 12 hour time. Most countries use 24 but US and some others like the 12 hour time.

Feature request: Cursor position

Would be great to see in the status bar at which position in the "byte stream" the cursor is.

Could be tricky with "multi cursor" use cases.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.