ls method

Future ls({
  1. String? dir = "/",
})

List directories in the local mutable namespace. For more: https://docs.ipfs.io/reference/http/api/#api-v0-files-ls

Implementation

Future<dynamic> ls({String? dir = "/"}) async {
  if (dir != null) _checkDir(dir);
  var params = {
    'arg': dir,
    'long': true,
    'U': true,
  };
  try {
    var response = await _ipfsService.post(
        url: '$url/api/v0/files/ls?',
        queryParameters: params,
        authorizationToken: authorizationToken);
    return response;
  } on DioError catch (e) {
    // The request was made and the server responded with a status code
    // that falls out of the range of 2xx and is also not 304.
    if (e.response != null) {
      return e.response?.data;
    }
  }
}