# DataStoreFile

Added in 1.0.0

*** ** * ** ***


```
public final class DataStoreFile
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/File.html` | `https://developer.android.com/reference/androidx/datastore/DataStoreFile#(android.content.Context).dataStoreFile(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html fileName)` Generate the File object for DataStore based on the provided context and name. |

## Public methods

### dataStoreFile

Artifact: [androidx.datastore:datastore](https://developer.android.com/jetpack/androidx/releases/datastore) [View Source](https://cs.android.com/search?q=file:androidx/datastore/DataStoreFile.android.kt+function:dataStoreFile) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/datastore#1.0.0)

```
public static final @NonNull File dataStoreFile(@NonNull Context receiver, @NonNull String fileName)
```

Generate the File object for DataStore based on the provided context and name. The file is generated by calling `File(context.applicationContext.filesDir, "datastore/$fileName")`. This is public to allow for testing and backwards compatibility (e.g. if moving from the `dataStore` delegate or context.createDataStore to DataStoreFactory).

Do NOT use the file outside of DataStore.

The context of the application used to get the files directory @fileName the file name