...like it Windows Explorer does.
JavaScript code:
/**
* Formats bytes mostly like Windows does,
* but in some rare cases the result is different.| #!/bin/sh | |
| # To the extent possible under law, Viktor Szakats | |
| # has waived all copyright and related or neighboring rights to this | |
| # script. | |
| # CC0 - https://creativecommons.org/publicdomain/zero/1.0/ | |
| # SPDX-License-Identifier: CC0-1.0 | |
| # THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| import java.nio.ByteBuffer; | |
| import java.util.UUID; | |
| public class UuidAdapter { | |
| public static byte[] getBytesFromUUID(UUID uuid) { | |
| ByteBuffer bb = ByteBuffer.wrap(new byte[16]); | |
| bb.putLong(uuid.getMostSignificantBits()); | |
| bb.putLong(uuid.getLeastSignificantBits()); | |
| return bb.array(); |
| import Foundation | |
| public class Storage { | |
| fileprivate init() { } | |
| enum Directory { | |
| // Only documents and other data that is user-generated, or that cannot otherwise be recreated by your application, should be stored in the <Application_Home>/Documents directory and will be automatically backed up by iCloud. | |
| case documents | |