5.10.112 • Published 11 months ago

@devtea2026/sunt-minus-doloremque-deserunt v5.10.112

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

readytogo-file

Safely perform async operations on the same file

Usage

import { instanceofFile, getFile } from '@devtea2026/sunt-minus-doloremque-deserunt';

const file = getFile('./data.txt');

instanceofFile(file); // returns true

file.read().then((data) => {
	console.log(data);
});

const newData = "new data";

file.write(newData).then(() => {
	console.log("success");
});

Note

If you used fs/promises directly, then the usage above would result in both read and write operations happening concurrently (asynchronously in small blocks). It would read a small block, write a small block, read, write, and result in unpredictable behavior. The write operation could complete before the read operation, resulting in a loss of data. For this reason, this module gives each file an asynchronous queue to process read/write operations in the order they are called, without blocking the event loop. This would make the usage above read the file completely first, then write the file completely. This still allows concurrent reading/writing of different files because there would be no race conditions. The instanceofFile() function is used to check if something is an instance of the File class. The getFile() function is used to get the instance associated with a file path. The file instance is a singleton, so calling getFile() with the same exact path will return the same instance. A relative path is resolved to an absolute path. If the current working directory is '/user', then getFile('./data.txt') will be resolved and saved as '/user/data.txt'. So, getFile('/user/data.txt') will return the same instance as getFile('./data.txt'). This guarantees that for any given file, there is only one instance with one asynchronous queue.

performantio-tsauthsyntaxerrorweakmapexewebsitemkdirsstatusES3dependenciesdebugkeysdirectoryes5whatwgjapaneseexecutableelbobjectansilinuxECMAScript 2016Uint16Arrayconnectbootstrap lesscloneslotWeakMapupcallbacktyped arraynodeinvariantparsebeanstalkreal-timebyteLengthpackage managerpredictablecloudsearchinferencecall-bounddescriptorcryptoprocessnegative zeroendpointregexpES2017stringstylingregexfast-clonepruneratemomentawaitgroupByesmimestartiamtypescript_.extendparentsrmfile systemasciiTypedArrayviewspeedArray.prototype.includeses8throttleES6robustHyBiemitStyleSheetsortedpackagesmimetypesstatelessqueueMicrotaskexit-codeReactiveXMicrosoftes2017pnpm9logmetadatapipeclassnamestsimportexportjsopensappargparserfc4122uuidrestfulgethasOwnArray.prototype.containsstarterirqruntimehigher-orderparentinspecturleditorcharactersresolvetraverseserializercoerciblestructuredCloneutil.inspectsnsrequirevaluebddproxyObservablehasutilityES2019equalbuffer.envomitquotedotenvboundsigtermchromeeast-asian-widthlintJSONconcatsortvalidatecorepreprocessorargsargumentes-shimsecmascripthttps__proto__mrupostcss-pluginextensionstylesheetidassertsidlechromiumoptimisteslintpasswordestreefasttaskweaksetES2021fastclonecolumnsonceworkercircularless mixinsspeccss-in-jsObject.entriesECMAScript 2018airbnbjsxtypeerrortypedECMAScript 2019consolewatchFileqsdayjswatchersearchloggingtoolkitArray.prototype.flatsqsbufferssymbolsavaString.prototype.matchAllObject.assignglacierfullmatchECMAScript 3toolsstyled-componentsassignindicatorarraybuffergetOwnPropertyDescriptorlookspinnerstextchaiargumentsargvbrowserslisttestisqueryprototypaniongradients cssmatchAllfigletvariableskinesisforEachstablecloudwatchfilefind-upglobglobalshelpershttplinewraplinkObject.valuesstreamentriesdeterministiccryptwidthURLSearchParamsbcrypttapetoSortedrapidtypesafecensoroperating-systempackage.jsoncolorsTypeBoxnested cssObservablesemojiArray.prototype.findLastcloudtrailcompareeventEmittercallboundcss variableeslint-plugincommandermodulesES2016launchphonejsonpathsequencediffownjoirecursivechannelshebangyupgetoptmime-dbBigInt64Arrayregularenvironmentstypedarraysfixed-widthfull-widthreduceURLreusetslibArrayBuffer.prototype.slicerestlockfileRFC-6455storagegatewaydirmatchesmacosReactiveExtensionsconcatMapreact-testing-librarys3shellsymbolreact-hooksES7zodfseventsintrinsiciteratemake dircjkdropeventsdatafunctionsprotobufReflect.getPrototypeOfprotocol-bufferselasticachejsdomworkflowwordbreakflattenparsergetteres-abstracteslintconfigstatecollection.es6ratelimitdatexdg-openloggeriterationsetPrototypeOfbundlerstreamssyntaxsetterexpressmkdirtesterESnexteveryautoprefixerpromisesjQueryworkspace:*ebscloudfrontObject.definePropertytrimEndguid@@toStringTagwindowsArray.prototype.flatMapuninstallES5trimhookforminstallnegativepersistentbatchECMAScript 2023descriptorsrdsaccessibilitygenericsmixinsreadRegExp#flagstelephoneUint8ArrayframeworkapitypesnopeES2022tapquerystringi18nsesfromloadbalancingelmlivemapreduceArrayBufferflagscolorlimitedincludesgdprECMAScript 2022visualdeep-cloneenvvalidxtermbrowserpropertiesStreamoptimizerWebSocketcopyRxinputinterruptsvariables in cssTypeScriptformswfsetUint8ClampedArrayjsonfshasOwnPropertydeletecharacterobjcss lessmergehotlesscssmakesideoutputFloat32ArraycsslengthimmerECMAScript 2020reduxscheme-validationsignalcommand-linerm -frSet0definePropertyrandomsuperagentdynamodbcode pointsprivatemonorepodefaultinstallerfunctionequalityelectronfindLastvpctermsettingsregular expressiongradients css3someflaghardlinksObject.fromEntriesprivate dataartsafeCSSclassesflatMapeslintpluginoffsetmiddlewarebreaknativetimeextraajaxwhichInt16ArraypropertymobilewaitprogressyamllastwarningsuperstructfastifyStreamsxhrencryptionES2015MapzerotestingvaluesjshintdeepcopyconcurrencydebuggerfindupisConcatSpreadabletrimRightstyleguidenamemovettyES2023fluxstringifyieutilBigUint64ArraytoStringTagshimdom-testing-librarykoreanregular expressionsfolderponyfillsymlinksless cssfindparsingbundlingpluginvarsauthenticationfast-deep-clonemochatypepropminimalwatchingfast-copylessnamesformates7core-jsECMAScript 2017Float64ArraywebES8walkingautoscalingxdgastiteratorl10npostcsscolourECMAScript 6fast-deep-copypackageaccessorUnderscoreenvironmentes-shim APIECMAScript 2015formsrouterbyteOffsetArray.prototype.filterclassnamecss nestinghandlersterminalfilterObject.isObjectvesta11ytypedarraykeyArrayBuffer#sliceserializesliceInt32ArrayexitexecsigintreactredactjavascriptjasmineES2018deepdataViewmulti-packagemapstyleurlswritableprototype[[Prototype]]eventDispatcherless compilerrgbpositiveoptionwafmkdirpfpsECMAScript 7getPrototypeOfprefixclicall-bindcmdSymbolenderescapeagentinternales2016walkerror-handlingdescriptionnodejsformattingbindcreatejwtlazynumberlistenersloadingassertionsameValueZeroreducerYAMLgetintrinsicbootstrap csscodesschemareact-hook-forminternal slotES2020tddString.prototype.trimerrorbluebirdsymlinktrimLeftstylesenumerablewordwrapbrowserlistpatchperformanceIteratorreadablestreamdataviewcollectionsinatra$.extendrequestbannerfullwidthless.jsfindLastIndexawsECMAScript 5asyncFunction.prototype.namereplaypathopenercontainsajvinroute53stdlibbytebusyprettyduplexcompile lessconsumeawesomesauceconfigurableECMAScript 2021checkdatastructuresignalsArray.prototype.findLastIndexwatchfastcopyPromiseextendpromiseJSON-SchemashamRxJSshrinkwrapclass-validatorimmutableamazonnpmsetImmediatees2015toobjectfunctionalcalljsdiffwgetconfigpicomatchRegExp.prototype.flagsrangeerrorArrayreadablehas-ownlibphonenumberrmdirlanguagecomputed-typesserializationInt8ArrayhooksemrSymbol.toStringTagwritetoArraycachetrimStartimportcorsObject.getPrototypeOf
5.10.111

11 months ago

5.10.110

11 months ago

5.10.112

11 months ago

5.10.109

11 months ago

5.10.108

11 months ago

5.10.107

11 months ago

5.10.106

11 months ago

5.10.105

11 months ago

1.1.29

1 year ago

1.1.28

1 year ago

3.6.65

1 year ago

3.6.64

1 year ago

3.6.63

1 year ago

4.7.92

11 months ago

4.7.90

11 months ago

4.7.91

11 months ago

3.6.62

1 year ago

3.6.61

1 year ago

3.6.60

1 year ago

4.7.81

12 months ago

4.7.82

12 months ago

4.7.80

12 months ago

4.7.85

12 months ago

4.7.86

12 months ago

4.7.83

12 months ago

4.7.84

12 months ago

4.7.89

11 months ago

4.7.87

12 months ago

4.7.88

12 months ago

2.5.58

1 year ago

2.5.59

1 year ago

5.8.97

11 months ago

5.8.98

11 months ago

5.8.99

11 months ago

2.5.60

1 year ago

4.6.66

1 year ago

4.6.65

1 year ago

1.5.54

1 year ago

1.5.53

1 year ago

1.5.56

1 year ago

1.5.55

1 year ago

1.5.58

1 year ago

5.9.101

11 months ago

1.5.57

1 year ago

5.9.100

11 months ago

1.3.42

1 year ago

1.3.43

1 year ago

1.3.40

1 year ago

1.3.41

1 year ago

1.3.46

1 year ago

1.1.23

1 year ago

1.3.47

1 year ago

1.1.22

1 year ago

1.3.44

1 year ago

1.1.21

1 year ago

1.3.45

1 year ago

1.1.27

1 year ago

1.1.26

1 year ago

1.1.25

1 year ago

1.1.24

1 year ago

1.2.40

1 year ago

4.8.92

11 months ago

4.8.94

11 months ago

4.8.93

11 months ago

4.8.96

11 months ago

4.8.95

11 months ago

4.8.97

11 months ago

3.5.60

1 year ago

4.7.70

12 months ago

4.7.71

12 months ago

4.7.74

12 months ago

4.7.75

12 months ago

4.7.72

12 months ago

4.7.73

12 months ago

4.7.78

12 months ago

4.7.79

12 months ago

4.7.76

12 months ago

4.7.77

12 months ago

5.10.104

11 months ago

5.10.103

11 months ago

5.10.102

11 months ago

5.10.101

11 months ago

1.4.48

1 year ago

1.4.47

1 year ago

1.4.49

1 year ago

5.9.99

11 months ago

1.2.29

1 year ago

4.7.67

1 year ago

4.7.68

1 year ago

1.4.51

1 year ago

4.7.66

1 year ago

1.4.50

1 year ago

1.4.53

1 year ago

1.2.30

1 year ago

1.4.52

1 year ago

1.2.31

1 year ago

4.7.69

12 months ago

1.2.34

1 year ago

1.2.35

1 year ago

1.2.32

1 year ago

1.2.33

1 year ago

1.2.38

1 year ago

1.2.39

1 year ago

1.2.36

1 year ago

1.2.37

1 year ago

1.1.20

1 year ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago