visionmedia / bytes.js

node byte string parser
MIT License
458 stars 57 forks source link

Methods #57

Closed Manikanta-20 closed 2 years ago

Manikanta-20 commented 4 years ago

Feature Request

Add Arthimetic,comparsion,other method which can be flexible. Provide method like add,subtract,multiply,divide,compare,convertTo ,etc,each method certain value Eg1:- bytes('10 gb').add('20 gb')->30gb/30

Eg2:- bytes('10 gb').add('30 gb').subtract('40 mb')->xxxxxxx.xxxx

dougwilson commented 2 years ago

Thanks for the suggestion, but imo this seems overly complicated, when you can just use the existing JavaScript numeric operations +, -, *, /, etc. Your two examples would be the following: Ex1: bytes(bytes('10 gb') + bytes('20 gb')) Ex2: bytes(bytes('10 gb') + bytes('20 gb') - bytes('40 mb'))